1

I am attempting to deploy the first MVC application to an existing production server. The application works in Visual Studio debug mode, but on the server, if I try to call up my home path I get an HTTP 403 error unless I enable directory browsing in IIS, in which case I see the contents of the directory, as you might expect.

The server is running Windows Server 2008 and is on the same domain as my development computer.

What I have tried so far:

  • Verified that .NET framework 4.5 has been installed on the server by checking the registry as described here.
  • Created a new node in the IIS Manager tree using "Add Application".
  • Upgraded the application node with aspnet_regiis.exe as described in this helpful post.
  • Set the application to allow Anonymous authentication to make sure the problem wasn't being caused by authentication errors.
  • Confirmed the presence of my Views folder and contents on the server as described here.
  • Attempted to deploy by copying my entire visual studio project to the application folder on the server.
  • Attempted to deploy by right-clicking and selecting Publish from the project node in the Visual Studio 2013 solution explorer. Selected "Delete all existing files prior to publish." I did this both with and without "Precompile during publishing".

Any ideas what to check next?

Community
  • 1
  • 1
Tim
  • 1,755
  • 2
  • 22
  • 34

3 Answers3

2

I finally fixed the problem by changing my Web.config file, adding the two lines below that reference the UrlRoutingModule. Do not add the preCondition="managedHandler" attribute!

<configuration>
  <system.webServer>
    <modules>

      <remove name="UrlRoutingModule-4.0"/>
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" />

    </modules>
  </system.webServer>
</configuration>

This helpful post by Thomas Marquardt discusses MVC routing in great detail.

Also, if you're troubleshooting your own MVC routing, be sure to check the answers posted by Ferruccio and stead.

Tim
  • 1,755
  • 2
  • 22
  • 34
1

You will also need to install the MVC framework on the server.

http://www.asp.net/mvc/mvc4

stead
  • 167
  • 1
  • 7
  • Thanks, I think this may be exactly my issue. I started installing from http://www.asp.net/mvc/mvc5, but the install wanted to add SQL server express. Is there a server installer that doesn't include the parts that are only useful in Visual Studio? – Tim Jan 31 '14 at 01:28
  • I dont have much experience with 5 but here is a link to the standalone installer...hopefully this helps. http://www.microsoft.com/en-us/download/details.aspx?id=30683 – stead Jan 31 '14 at 04:31
  • Not yet, but I haven't had a chance to reboot the server yet. – Tim Feb 04 '14 at 20:00
1

I've had a similar problem. It turned out that the deployment process put it into the DefaultAppPool, which uses .NET 2.0. Once I moved it to the "ASP.NET v4.0" app pool, it started working.

In IIS Manager, right click on the app and select "Manage Application". Then select "Advanced Settings..." and change the app pool.

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
  • Forgot to mention that I had tried this, but your answer is sure to help someone! Thank you! – Tim Jan 31 '14 at 01:31