在IIS 7上托管新的asp.net MVC Web应用程序,将显示以下错误"页面无法显示"访问其主页时

时间:2018-01-22 14:50:46

标签: asp.net asp.net-mvc iis iis-7

在我的Visual Studio 2012中,我创建了一个新的asp.net MVC Web应用程序,其中包含简单的Home控制器及其基本的Index视图。然后使用VS 2012我创建了一个Web部署包(生成.zip文件),然后我执行了以下操作: -

  1. 在IIS 7.0中,我在端口4377上创建了一个新网站。
  2. 然后我将mvc文件移到新网站中,如下所示: -
  3. enter image description here 3.但是当我尝试使用浏览器以下网址http://localhost/4377时出现以下错误: -

    enter image description here

    而不是重定向到索引视图。 所以我不确定可能是什么问题? 我已经检查了匿名访问并启用了它: -

    enter image description here

    这里也是我的web.config: -

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
      <appSettings>
        <add key="webpages:Version" value="2.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="PreserveLoginUrl" value="true" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
    
      <system.web>
    
        <httpRuntime targetFramework="4.5" />
    
        <compilation targetFramework="4.5" />
    
        <pages>
          <namespaces>
            <add namespace="System.Web.Helpers" />
            <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.Web.WebPages" />
          </namespaces>
        </pages>
            <identity impersonate="true" />
      </system.web>
    
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
    
      <handlers>
          <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></system.webServer>
    </configuration>
    

    所以有人可以这样做吗? 感谢

    这是我的routing.config: -

    {
            public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
    

0 个答案:

没有答案