In IIS 5.1, I have setup a website to point to my ASP.NET MVC project directory, and I get a "Service Unavailable" error when I try to access it after building the project. It seems I have to publish the site to a separate directory and point IIS to the published version to get it to work.
I have already tried "aspnet_regiis" but that did not fix the issue. I have also setup wildcard mapping so all requests are sent through the ASP.NET pipeline.
I'm not sure why I would have to publish the files in order to view them. The published version appears to only remove unnecessary files, but the published files seem to be identical to the ones in the actual project directory.
Do you have to publish an ASP.NET MVC website to a different directory in order for IIS to serve it?
Ideally, I would want to set it up such that all I have to do is build the project, and I can immediately view the updated website by visiting localhost.
Update:
The version is set to 2.0, and when I get home I will check if the IUSR account has sufficient privileges. I can't imagine why it wouldn't because the published folder apparently had them by default.
Update #2:
The errors in the event log are:
Failed to initialize the AppDomain:/LM/W3SVC/1/Root
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
and
Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005 Access is denied.
I have given the MY_MACHINE\ASPNET account "Act as operating system" privileges and I still get this error.
Update #3:
So this is interesting... I have XP Media Center Edition, so I forgot I don't have a security tab to verify permissions.
I decided to copy and paste the entire solution into a newly created folder and it works perfectly. This indicates that it's a permission issue but not with the ASPNET user. I will try to activate the Security tab and make a 4th (and hopefully final) update.
Update #4:
It turns out that when I copied the directory, the permissions changed to allow Everyone access to it. When I checked the original project directory, the ASPNET user was not granted any permissions in the directory.
The simple solution was to grant the ASPNET user read privileges on the project directory.
No problems at all. I've been running an MVC app on IIS5.1 for 6 moths while developing it.
First off check the version of ASP.Net used for your site.
If that isn't the problem check that the user account used to run your website has permissions to the directory and all the files and folders contained within it and make sure that the network service has permissions.
take a look at this link - which might help:
http://weblogs.asp.net/bdesmond/archive/2003/09/20/28441.aspx
Related
I've inherited a new project. The website (MVC.NET) is referencing a file location on the Windows 2012 server (it appears to be hard coded) but the file is not in the same directory as the website.
Part of the code copies a file from one location to another using File.Copy but this is causing an exception.
Apparently it was working yesterday and today it isn't. The website is down and as such I'm looking to resolve it.
The error message from the browser is
Access to the path 'C:\Websites\Website\Content\Images\Uploads\Certificate 1.jpg' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\Websites\Website\Content\Images\Uploads\Certificate 1.jpg' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
The easiest way to fix this (as a temporary fix just to get the website up and running) I thought was to give full permissions to that folder, meaning adding Everyone with full permission. It didn't work. I'm not curious as to why.
I'm aware of the risks this has but my question is why this doesn't work. Why do I still see the same error message?
I can RDP into the server and access the file without issue. As such, I don't believe this is a server issue (for ServerFault or SuperUser).
I suspect it's a protection thing in .NET. In the same way (if I remember right) we had to set special permissions in IIS to allow parent paths in ASP.
What do I need to do?
Edit
I've uploaded the website to another server and the same issue persists, suggesting the fault is not anything to do with the computer but more due to .NET or IIS
IIS is set to use Integrated Managed Pipe (not classic) and I've tried adding permission for NETWORK SERVICE and IUSR.
The solution was odd... I don't understand the why/how but I understand the what. I have no idea if this will help others, but I've posted the answer regardless
The application allows pictures to be uploaded, which are stored in
C:\someUploads
When the website is loaded, it copies the files from C:\someUploads to the website path as shown in the original post.
This is where the issue was occurring. I removed all the images in the website path (as shown in the original post) and restarted the website and it just worked, copying all the files in as expected. I closed the website, restarted IIS and the app pool (recycle) and it's still working.
Check the folder exists in Web.config and include
<add key="filePath" value="C:\Websites\Website\Content\Images\Uploads\" />
and check the folder path of IIS Server location.
I am struggling with trying to publish a site.
I have made a basic web site with ASP.NET MVC and I now want to host it on a pc.
I have opened ISI manager and added a new site. I set the default directly to the directly where the files for the site are stored but when i navigate to the pc I don't get my site. I get an IIS server error in application error.
What steps do i need to do to get the a basic site to run on the server.
First, you need to have installed iis, this is done you have to register the asp.net framework, for this you need to run a command line.
Go to cmd and type:
aspnet_regiis -i
Done so please enter
http:// localhost/AplicationName
If you get an error, then you should really post that error with your question. However, since the most common problem in the scenario you describe is permissions, I'm going to assume that that is your problem.
Unless you're going to put your code in a directory owned by IIS (such as "inetpub"), then you need to give the IIS user or group rights to the directory your code is in. You can do this by right-clicking the directory in Windows Explorer, and choosing "Properties". Then click the "Security" tab. Use the "Edit..." button to add the IIS user or group. It should be named something along the lines of "IIS_*". You'll need to grant full control, so just like any other publicly available directory (including "inetpub"), you should ensure that there's nothing secure or compromising in that directory.
I am using VS2013 preview to deploy a simple MVC application to Azure. This worked for a while but now the deployment fails for some DLLs as shown below:
2>Publishing folder bin...
2>Unable to add 'bin/EntityFramework.SqlServer.dll' to the Web site. The specified network name is no longer available (550).
2>Unable to add 'bin/Newtonsoft.Json.dll' to the Web site. The specified network name is no longer available (550).
2>Unable to add 'bin/System.Web.Mvc.dll' to the Web site. The specified network name is no longer available (550).
2>Unable to add 'bin/WebGrease.dll' to the Web site. The specified network name is no longer available (550).
2>Publishing folder Content...
Has anyone come across this problem and know why this happens? All other DLLs and files make it across without problem.
I was able to publish the same project in VS2012. Therefore this is a bug in the version of the VS2013 preview that I was using.
I am trying to run the my asp.net mvc project on IIS 7 , I am trying to impersonate the user. Where Data is the data project of my application, i have added the dll reference to the asp.net mvc project
I tried giving full control to very one to this folder
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET File.
Any clue on how to fix this error?
Try running aspnet_regiis exe in the framework folder. With the -ga option, that will grant the impersonation user all the relevant permissions.
You could try using Process Monitor from Windows SysInternals, this will tell you exactly which file is getting the access denied message. I've used this tool on many occations to find access problems with files and the registry.
I add the data.dll in the GAC and that fixed the issue.
I am having some trouble when publishing an MVC application to a server, and even to my personal computer.
The server has the MVC framework installed so that is not the problem, and I also have it installed obviously.
The problem on my local machine is obviously a permissions thing but im not sure what permissions are needed... I tried adding IUSR to the application itself.
The iis error message is:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070005
Config Error Cannot read configuration file due to insufficient permissions
Config File ~\Visual Studio 2008\Project\MVCApp\web.config
and on the server im getting "The page cannot be found" when trying to view anything in the app.
also this is a forms auth app that denys everything but authenticated users
You need to have wildcard mappings turned on so that it can resolve the routes.
Take a look at option 1:
http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/
Basically, IIS is trying to locate a file at the given URL, but it doesn't exist because they are MVC Routes. You need to tell IIS to hand off the request to the ASP.Net route handler, and not to worry about checking if the file exists on the file system. (it will never exist)
I found out that upgrading an MVC 2 project to MVC 3 resulted in the sam error as described above:
Module IIS Web Core Notification BeginRequest Handler Not yet determined Error Code 0x80070005 Config Error Cannot read configuration file due to insufficient permissions Config File ~\Visual Studio 2010\Project\MVCApp\web.config
What solved the problem for me was to delete the Virtual Directory for the project in my localhost IIS, and then clean and rebuild the project.
NOTE! This was an MVC2 project in VS2010 - not VS2008.