我最近下载了VS2010的beta 2并开始使用ASP.NET MVC2.最初的开发是使用Casini完成的,但现在我想从IIS 7.5运行应用程序(我正在运行Windows 7).我已经安装了IIS6配置数据库兼容性,我以管理员身份运行VS2010,因此我可以使用项目设置的"Web"选项卡中的"创建虚拟目录"按钮.这在IIS中创建了Web应用程序条目,但它不起作用.
当我转到主页面(http:// localhost/MyMvcApp /)时,我收到HTTP 403错误.当我直接进入其中一个子页面(http:// localhost/MyMvcApp/Home /)时,我得到一个HTTP 404.
所以我想由于某种原因URL路由不起作用.我已经将UrlRouting添加为web.config的模块和处理程序.在我的搜索中,这是一些类似问题的解决方案.但对我来说,这仍然无效.
我的web.config有趣的部分是这样的:
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> …Run Code Online (Sandbox Code Playgroud)