views:

307

answers:

2

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.

+3  A: 

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

Lewis
+1 - Right on, the directory didn't have permission for the `ASPNET` account
John Rasch
A: 

I have the same problem as OP. After you publish for the first time Visual studio puts all subsequent builds in the publish directory (which iis cant access if it's in the project dir) and yets when you chose "run" it runs the build directory, giving the impression that no changes have been made. Needless to say, this is retarded as VS is assuming all subsequent builds are publishes (while still calling it a build) I want a way, after publishing, to have VS use my normal build directory, please help. Kind Regards Shane Scott