As I said briefly it was a missing handler in the IIS HTTP Handler configuration. To give a quick summary on how I converted an existing ASP.NET Application into an MVC Application, these steps were done:
1. Add the following references to the project: System.Web.Mvc, System.Web.Routing, System.Web.Abstractions. If the IIS7 does not have these DLL files in the GAC, you'll need to copy them.
2. Create the required folder structure in the solution for the MVC Framework:
Controllers & Views folders
3. Add the required files to the project, such as the default HomeController and related views.
4. Update the web.config file of the application to make sure the following entries are present (I've marked the additions in bold. Don't use this config file, but use your own !!!!)
5. Add the required routes to the global.asax file:
- ignore all resources ending in .aspx
6. Add the httphandler to IIS to catch MVC requests:
- Name : MVC Handler
- Path: *
- Type: System.Web.Mvc.MvcHttpHandler
- mapping : unvink the request to file/folder
- verbs : all
- access : read
- order: right above any other wildcard or static handler.
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Virtual Directory
Dec 03, 2010 02:23 PM|LINK
please tell what the problem were...
Nai-Dong Jin...
All-Star
41630 Points
3558 Posts
Re: Virtual Directory
Dec 06, 2010 01:24 AM|LINK
Hi,
Could you please share the workaround so that it can benifit other members.
Thanks.
Arne De Herd...
Member
1 Points
29 Posts
Re: Virtual Directory
Dec 06, 2010 07:25 AM|LINK
Oh, sure.
As I said briefly it was a missing handler in the IIS HTTP Handler configuration. To give a quick summary on how I converted an existing ASP.NET Application into an MVC Application, these steps were done:
1. Add the following references to the project: System.Web.Mvc, System.Web.Routing, System.Web.Abstractions. If the IIS7 does not have these DLL files in the GAC, you'll need to copy them.
2. Create the required folder structure in the solution for the MVC Framework: Controllers & Views folders
3. Add the required files to the project, such as the default HomeController and related views.
4. Update the web.config file of the application to make sure the following entries are present (I've marked the additions in bold. Don't use this config file, but use your own !!!!)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <pages> <namespaces> <!--Needed for sandcastle documentation.--> <add namespace="System" /> <add namespace="System.Collections.Generic" /> <add namespace="System.Globalization" /> <add namespace="System.IO" /> <add namespace="System.Runtime.Serialization.Formatters.Binary" /> <add namespace="System.Text" /> <add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" /> <add namespace="System.Web.UI" /> <add namespace="System.Xml" /> <add namespace="System.Xml.XPath" /> <!-- MVC Namespace References --> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Linq" /> </namespaces> </pages> <compilation debug="true"> <assemblies> <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.DirectoryServices.Protocols, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <!-- MVC Assembly References --> <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx" /> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpHandlers> <httpModules> <add name="ErrorModule" type="TenForce.Execution.Web.Modules.ErrorModule, RobinsonWebApp" /> <add name="RewriteModule" type="TenForce.Execution.Web.Modules.RewriteModule, RobinsonWebApp" /> <add name="SecurityModule" type="TenForce.Execution.Web.Modules.SecurityModule, RobinsonWebApp" /> <add name="VersionStaticFileModule" type="TenForce.Execution.Web.Modules.VersionStaticFileModule, RobinsonWebApp" /> <add name="CompressionModule" type="TenForce.Execution.Web.Modules.CompressionModule, RobinsonWebApp" /> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpModules> </system.web> <add name="MVC Handler" path="*" verb="*" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Read" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" /> </handlers> </configuration>5. Add the required routes to the global.asax file:
- ignore all resources ending in .aspx
6. Add the httphandler to IIS to catch MVC requests:
- Name : MVC Handler
- Path: *
- Type: System.Web.Mvc.MvcHttpHandler
- mapping : unvink the request to file/folder
- verbs : all
- access : read
- order: right above any other wildcard or static handler.