bas
bas

Reputation: 14932

Run MVC4 webapplication on local IIS webserver

UPDATED - pointed to the wrong directory at first. Thanks for the tip Wiktor. Still not succeeded in running the MVC4 application via

I am trying (for a while now.. :)) to set up a simulated multi tenant webapp on my development PC. I learned that this is not possible with visual studio's internal webserver, so I am trying to set up IIS.

I added the fake tenants in my hosts.

127.0.0.1 localhost
127.0.0.1 tenant1.mydomain.com
127.0.0.1 tenant2.mydomain.com

In IIS I made a new website test(port 8081), and just pointed it to C:\Azure\Websites\. In that directory I added a Hello World html file to see if this bit works.

Cool, first proof of life.


Next step: getting this working with a MVC4 webapp created in VS2012.

I started a new MVC4 webapp and stored it in: C:\Azure\Websites\MvcApplication1

I just use the default generated website for the test, so I pressed F5 and verified the site is opened in firefox. So the goal is to get this working from IIS.

HTTP Error 500.21 - Internal Server Error Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

Uninstalled ASP.NET and reinstalled it again. Same results.

when I change web.config from

preCondition="classicMode,runtimeVersionv4.0,bitness32"

to

preCondition="integratedMode,runtimeVersionv4.0,bitness32"

Then I get this error:

HTTP Error 404.2 - Not Found The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

Can I stress the fact that I am a n00b regarding IIS configuration... :)

Any ideas?

Upvotes: 1

Views: 3626

Answers (3)

Bhanu pratap
Bhanu pratap

Reputation: 79

first configure IIS as Manual configuration Open your Control Panel and click Programs and Features » Turn Windows features on or off. Turn on Internet Information Services.

Under Internet Information Services, turn on the following features: Web Management Tools » IIS 6 Management Compatibility » IIS Metabase and IIS 6 configuration compatibility.

Web Management Tools » IIS Management Console, IIS Management Scripts and Tools, and Management Service.

Under World Wide Web Services, turn on the following: All features under Application Development features, except Server-Side Includes. Common HTTP Features » Default Document, Directory Browsing, HTTP errors, Http Redirection, Static Content. Security » Basic Authentication, Request Filtering, Windows Authentication.

Under Microsoft .NET Framework 3.5.1 » Windows Communication Foundation HTTP Activation.

After you have created your website, open the Internet Information Services (IIS) Manger. Expand your server node. Expand Sites node and click your website.

In section IIS on the right, double-click Authentication. Perform one of the following:

If you are using Forms authentication, make sure Anonymous Authentication and Forms Authentication are enabled and all other authentications are disabled.

If you are using Claims-based authentication, make sure only Anonymous Authentication is enabled and all other authentications are disabled.

Click your website again and in IIS section, double-click Handler Mappings. Make sure you have enabled handler mappings for *.svc and *.xamlx with executable path set to one of the following:

For 64-bit OS: %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll For 32-bit OS: %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll Close the Internet Information Services (IIS) Manger.

Upvotes: 0

Bhanu pratap
Bhanu pratap

Reputation: 79

First configure IIS according this site:

IIS 7.5 handler "extensionlessurlhandler-integrated-4.0" has a bad module "managedpipelinehandler" in its module list

For the above issue, you must go to Control Panel >> Installed Programs and Features >> Repair your .NET Framework by double clicking on it.

Upvotes: 0

bas
bas

Reputation: 14932

ISAPI and CGI Restictions in IIS:

  • Add isapi dll for .net 4 32bit
  • Add isapi dll for .net 4 64bit

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

And it works. Finally!

Thanks Wiktor

Upvotes: 1

Related Questions