Asp.Net 5网站无法在IIS Express 10上加载

时间:2016-01-17 17:54:15

标签: asp.net-core-mvc iis-express asp.net5

我试图让我的ASP.Net 5 MVC6网站在IIS Express 10上运行,它一直给我一个错误,上面写着:

  

HTTP错误500.19 - 内部服务器错误   无法访问请求的页面,因为页面的相关配置数据无效。

(图片附加完整错误)

我已经在Visual Studio 2015社区内成功运行了该网站,但我想要一个“永远在线”的解决方案,所以我不必在VS内继续启动和停止该网站。

我在IISExpress / config / applicationhost.config文件中有以下内容:

<sites>
    <site name="Admin" id="1" serverAutoStart="true">
        <application path="/">
            <virtualDirectory path="/" physicalPath="C:\Users\Admin\Documents\Visual Studio 2015\Projects\CMS\src\Admin\wwwroot" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation=":12345:localhost" />
        </bindings>
    </site>
    <siteDefaults>
        <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
        <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
    </siteDefaults>
    <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
    <virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>

我使用的网址是:http://localhost:12345/

我的web.config文件中有以下内容:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <handlers>
          <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
          <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600" forwardWindowsAuthToken="true" />
      </system.webServer>
    </configuration>

我的project.json文件

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

enter image description here

1 个答案:

答案 0 :(得分:0)

我在Azure Web App中遇到了同样的问题。我设法通过从startupTimeLimit forwardWindowsAuthToken标记中删除web.confighttpPlatform属性来解决此问题。我通过比较我的项目和工作项目找到了解决方案。不知道去除属性是否有一些副作用。