Asp.net core deployment does not work on the server, but works on the machine

I am trying to deploy the main asp.net application on the server. I have taken the following steps.

First, first, this is the Windows R2 2012 R2 environment, which is a new virtual machine.

  • build VM
  • update all ms updates
  • add iis role
  • insure asp.net 3.5 and 4.5 installed on the machine
  • Insure HTTP redirection and static content.
  • install .net core bundle
  • Publish a stand-alone application from Visual Studio (Web project name)
  • add this to the folder on the server.
  • try running web.exe

I open a console application that now says: http: // localhost: 5000 10. I switch to http: // localhost: 5000 from chrome on this computer and cannot find 404.

I do steps 7 8 9 and 10 on the local machine, which is window 10, I get my application.

project.json

{ "dependencies": { "AutoMapper": "5.1.1", "EntityFramework": "6.1.3", "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" }, "tools": { "BundlerMinifier.Core": "2.0.238", "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "frameworks": { "net452": { "dependencies": { "DataAccess": { "target": "project" }, "Models": { "target": "project" } } } }, "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true }, "publishOptions": { "include": [ "wwwroot", "Views", "Areas/**/Views", "appsettings.json", "web.config" ] }, "runtimes": { "win10-x64": {}, "osx.10.11-64": {} }, "scripts": { "prepublish": [ "bower install", "dotnet bundle" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } } 

configure from startup.cs

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { Mapper.Initialize(config => { /*View Models*/ config.CreateMap<Permit, PermitViewModel>().ReverseMap(); config.CreateMap<PermitType, PermitTypeViewModel>().ReverseMap(); config.CreateMap<Property, PropertyViewModel>().ReverseMap(); config.CreateMap<Region, RegionViewModel>().ReverseMap(); config.CreateMap<State, StateViewModel>().ReverseMap(); config.CreateMap<User, UserViewModel>().ReverseMap(); /*Dtos*/ config.CreateMap<Permit, PermitDto>().ReverseMap(); config.CreateMap<Property, PropertyDto>().ReverseMap(); config.CreateMap<Region, RegionDto>().ReverseMap(); config.CreateMap<State, StateDto>().ReverseMap(); config.CreateMap<User, UserDto>().ReverseMap(); }); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseApplicationInsightsRequestTelemetry(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } 

Program.cs

 public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } 

My goal is to run this launch on iis.

UPDATE

Software: Microsoft Internet Information Services 8.5

Version: 1.0

Date: 2016-12-06 23:49:44

Fields: time date s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs (User-Agent) cs (Referer) sc-status sc-substatus

sc-win32 status based on time 2016-12-06 23:49:44 fe80 :: 9c6d: a91b: 42c: 82ea% 12 OPTIONS / - 80 - fe80 :: c510: a062: 136b: abe9% 12 DavClnt - 200 0 0 1139 2016-12-06 23:49:47 fe80 :: 9c6d: a91b: 42c: 82ea% 12 OPTIONS / website - 80 - fe80 :: c510: a062: 136b: abe9% 12 Microsoft-WebDAV-MiniRedir / 10.0 .14393 - 200 0 0 46 2016-12-06 23:49:47 fe80 :: 9c6d: a91b: 42c: 82ea% 12 PROPFIND / website - 80 - fe80 :: c510: a062: 136b: abe9% 12 Microsoft-WebDAV -MiniRedir / 10.0.14393 - 404 0 2 62 2016-12-06 23:49:47 fe80 :: 9c6d: a91b: 42c: 82ea% 12 PROPFIND / website - 80 - fe80 :: c510: a062: 136b: abe9% 12 Microsoft-WebDAV-MiniRedir / 10.0.14393 - 404 0 2 62

this is the log message i get

web.config

 <?xml version="1.0" encoding="utf-8"?> <configuration> <!-- Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380 --> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/> </system.webServer> </configuration> 
+7
c # iis deployment asp.net-core
source share
3 answers

Please check "platform": "anycpu" in the platform part:

 "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" }, 

and

  "buildOptions": { "platform": "anycpu", "emitEntryPoint": true, "preserveCompilationContext": true }, 
+3
source share

This is a problem that will really benefit from more documentation. This is exactly how I do it, and I am not saying that this is the only way.

1. Make sure dotnetcore hosting is installed

2. Create an application pool that targets "no managed code"

3. Create a website that uses this application pool (here you define your IP address and port that IIS will listen to)

4.Uninstall the web deployment package (Visual Studio) (which will provide you with a zip folder)

5. Run this zip folder on the server

6. To your website that you created and right-click on the website (make sure the website is stopped)

7. I can’t remember the exact option, but it’s something like the “Site Management” effect. You should get another menu that will give you the opportunity to import

8.Click and find this zip folder. You can configure other parameters.

9. After that, restart the website

10. Then you can go to your application in the browser using the IP address that was configured for the website in IIS

+1
source share

If I'm not mistaken, your .json project does not have a link to asp.NET-core, but to the full structure:

 "frameworks": { "net452": { "dependencies": { "DataAccess": { "target": "project" }, "Models": { "target": "project" } } } }, 

I think you are missing this place for targeting .NETCore :)

 "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" }, 
0
source share

All Articles