Error while deploying MVC 5 application on Windows Server 2008

135 views Asked by At

I have published my MVC 5 application and copied all the files from local PC to Server D drive.

Server is Windows Server 2008 SP1.

I installed .NET Framework 4.5 on server.

I created a separate Application Pool with .NET Framework 4.0 in Integrated Mode.

In IIS, I right-click Sites and select New Web Site.

In the physical path I am pointing to the same D Drive on Server where published files are located.

When I try to browse, it gives error:

No default document configured.

Is this because Windows Server Service Pack 2 is not installed? Does it require SP2 for MVC 5 application?

I have also registed ASP.NET 4.0 by running:

aspnet_regiis -i

from the command prompt.

1

There are 1 answers

0
Ala On

This is a known problem when deploying MVC application on Windows Server 2008 R2 regarding extension less URLs: You can find more in this article:

http://blogs.msdn.com/b/tmarq/archive/2010/04/01/asp-net-4-0-enables-routing-of-extensionless-urls-without-impacting-static-requests.aspx

You need to run the hotfix from Microsoft in this link: https://support.microsoft.com/en-us/kb/980368

then add the following in your web.config file:

<handlers>
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>