[英]How to deploy an ASP.NET Core targetting net452 project as an IIS application of a Web Site in IIS
I want to deploy an ASP.NET Core RTM web app targeting net452 to an IIS application and not IIS website. 我想将面向net452的ASP.NET Core RTM Web应用程序部署到IIS应用程序而不是IIS网站。 I am using IIS 10 (windows 10) 我正在使用IIS 10(Windows 10)
I previously had an ASP.net 5 RC1
project and deployed it to an IIS application folder in IIS using the method described here and here 我以前有一个ASP.net 5 RC1
项目,并使用此处和此处描述的方法将其部署到IIS中的IIS应用程序文件夹
I need to run the website as a application under my website eg http://locahost/mysite in IIS and I achieved this in RC1 by adding the following code line to the Configure
method in my Startup.cs
我需要在我的网站上运行网站作为应用程序,例如IIS中的http:// locahost / mysite ,我在RC1中通过将以下代码行添加到我的Startup.cs
的Configure
方法来实现这一点
app.Map("/MyApplication", (app1) => this.Configure1(app1, env, loggerFactory));
After I converted my project to ASP.net core it can run successfully in Visual Studio however the above code now just gives me a blank page in IIS when I access the URL http://localhost/mysite
将我的项目转换为ASP.net核心后,它可以在Visual Studio中成功运行,但是当我访问URL http://localhost/mysite
时,上面的代码现在只在IIS中给我一个空白页面
I have made sure I have everything I needed in my code from the ASP.NET documentation website on how to deploy ASP.NET Core to IIS including installing the installer and doing an iireset
. 我已经确保我在ASP.NET文档网站上的代码中有关于如何将ASP.NET Core部署到IIS的所有内容,包括安装安装程序和执行iireset
。
But after following everything required to setup I get the same blank screen. 但在完成设置所需的一切后,我得到了相同的空白屏幕。
Now I am stuck. 现在我被卡住了。
I then enabled logging. 然后我启用了日志记录 When I enabled logging in my web.config
I get the following when I try to access my website 当我在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
From the above you can see it picked up I put in my browser the url, and created a log entry however the end result in the browser is still a blank page. 从上面你可以看到我把它放在我的浏览器中的url,并创建了一个日志条目但是浏览器中的最终结果仍然是一个空白页面。
I then read the log from the start and for one or other reason it is listening on port 8308 and not port 80. So I put in http://localhost:8305/mysite
in my browser and I get the following in the log 然后我从头开始读取日志,由于其中一个原因,它正在侦听端口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
and still a blank page. 仍然是一个空白页面。
I just want to host the web app which targets on IIS and previously did it in ASP.NET 5 RC. 我只想托管在IIS上使用的Web应用程序,之前在ASP.NET 5 RC中执行此操作。 What am I doing wrong in ASP.NET Core or is it not possible anymore? 我在ASP.NET Core中做错了什么,或者它不再可能了?
the 该
app.Map("/MyApplication", (app1) => this.Configure1(app1, env, loggerFactory));
workaround is no longer required in ASP.NET Core RC2 or RTM where as it was required in RC1 在RC1中需要的ASP.NET Core RC2或RTM中不再需要解决方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.