如何将ASP.NET Core目标net452项目部署为IIS中

时间:2016-08-15 12:55:26

标签: iis asp.net-core asp.net-core-mvc iis-10

我想将面向net452的ASP.NET Core RTM Web应用程序部署到IIS应用程序而不是IIS网站。我正在使用IIS 10(Windows 10)

我之前有一个ASP.net 5 RC1项目,并使用herehere

描述的方法将其部署到IIS中的IIS应用程序文件夹中

我需要将网站作为我网站上的应用程序运行,例如IIS中的http://locahost/mysite我在RC1中通过向Configure

中的Startup.cs方法添加以下代码行来实现此目的
app.Map("/MyApplication", (app1) => this.Configure1(app1, env, loggerFactory));

将项目转换为ASP.net核心后,它可以在Visual Studio中成功运行,但是当我访问URL http://localhost/mysite

时,上面的代码现在只在IIS中给我一个空白页面

我已确保在ASP.NET documentation website中我的代码中有关于如何将ASP.NET Core部署到IIS的所有内容,包括安装安装程序和执行iireset

enter image description here  但是在完成设置所需的一切后,我得到了相同的空白屏幕。

现在我被卡住了。

然后我启用了日志记录。当我启用我的web.config登录时,当我尝试访问我的网站时,我得到以下内容

info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
      User profile not available. Using 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\AutoGenKeys\S<removed>\DataProtection' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Content root path: C:\mydeployfolder
Now listening on: http://localhost:8305/mysite
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost/mysite

从上面你可以看到我把它放入我的浏览器中的url,并创建了一个日志条目但是浏览器中的最终结果仍然是一个空白页。

然后我从头开始读取日志,由于其中一个原因,它正在侦听端口8308而不是端口80.所以我在浏览器中输入http://localhost:8305/mysite并在日志中获得以下内容

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:8305/mars  
fail: Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware[0]
      'MS-ASPNETCORE-TOKEN' does not match the expected pairing token '<removed>', request rejected.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.9426ms 400 
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:8305/favicon.ico  
fail: Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware[0]
      'MS-ASPNETCORE-TOKEN' does not match the expected pairing token '52561883-06a6-46ce-b8dc-5daadb6e83c0', request rejected.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.7004ms 400 

仍然是一个空白页。

我只想托管以IIS为目标的Web应用程序,之前在ASP.NET 5 RC中进行了此操作。我在ASP.NET Core中做错了什么,或者它不再可能了?

0 个答案:

没有答案