1
votes

I want to deploy an ASP.NET Core RTM web app targeting net452 to an IIS application and not IIS website. I am using 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

I need to run the website as a application under my website e.g. 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

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

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.

enter image description here 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

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.

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

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. What am I doing wrong in ASP.NET Core or is it not possible anymore?

1
whats is your applicationUrl in launchSettings.json?Ja9ad335h
that is the dev url when I debug from visual studio localhost:49753 launchUrl is localhost:5000dfmetro
Did you check that your code work as site ?dotnetstep
code work in debug and in release mode running from Visual Studio. Just does nothing when publishingdfmetro

1 Answers

0
votes

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