简体   繁体   English

ASP.NET Core 1.1在发布时无法运行

[英]ASP.NET Core 1.1 fails to run when published

I had an ASP.NET Core application that I just went in an upgraded to 1.1. 我有一个ASP.NET核心应用程序,我刚刚升级到1.1。 This application worked fine previously and I could publish it (through Publish Command in Visual Studio) and it worked fine under IIS. 此应用程序以前工作正常,我可以发布它(通过Visual Studio中的发布命令),它在IIS下工作正常。 I recent changed this be 1.1 and got the application to run in debug mode fine. 我最近将此更改为1.1并使应用程序在调试模式下运行正常。 Now when I publish it I get 现在,当我发布它时,我得到了

502 - Web server received an invalid response while acting as a gateway or proxy server.

I turned on Failed Request Tracing Rules and in there I see the following 我打开了失败请求跟踪规则,在那里我看到以下内容

MODULE_SET_RESPONSE_ERROR_STATUS 

ModuleName httpPlatformHandler 
Notification EXECUTE_REQUEST_HANDLER 
HttpStatus 502 
HttpReason Bad Gateway 
HttpSubStatus 3 
ErrorCode The server is currently disabled. (0x8007053d) 

My published web.config file looks like this 我发布的web.config文件如下所示

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <remove name="httpPlatform" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Cranalytics.dll" forwardWindowsAuthToken="true" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

My project.json file looks like this 我的project.json文件看起来像这样

{
  "dependencies": {
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",

    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",

    "Microsoft.Extensions.Caching.Memory": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",

    "Syncfusion.Compression.MVC": "14.2600.0.32-preview2-final",
    "Syncfusion.XlsIO.MVC": "14.2600.0.32-preview2-final",

    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2",

    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",

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

    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
    //"net461": {
    //  "dependencies": {
    //  },
    //  "imports": "dnxcore50"
    //}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config",
      "appsettings.Production.json",
      "appsettings.Staging.json",
      "appsettings.json"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

I can't find out what the problem is with the configuration or IIS. 我无法找出配置或IIS的问题。

Edit: I made some changes to configuration and am now past the module loading section (at least according to the Trace Log). 编辑:我对配置进行了一些更改,现在已超过模块加载部分(至少根据跟踪日志)。 Now I'm just getting 404 whenever I visit the website. 现在我每次访问网站时都会得到404。 I can view static images without a problem, but when I view the home page to the site I get a 404 error 我可以毫无问题地查看静态图像,但当我查看主页到网站时,我收到404错误

ModuleName AspNetCoreModule 
Notification EXECUTE_REQUEST_HANDLER 
HttpStatus 404 
HttpReason Not Found 
HttpSubStatus 0 
ErrorCode The operation completed successfully. (0x0) 

My published directory structure is a sub site underneath the root site in IIS (/Cranalytics). 我发布的目录结构是IIS(/ Cranalytics)中根网站下的子站点。 Then in that folder is all of the various DLL, along with the web.config. 然后在该文件夹中是所有各种DLL,以及web.config。 Under this directory is the wwwroot directory from the project. 在此目录下是项目的wwwroot目录。 The IIS subsite is set pointing to the root site (/Cranalytics). IIS子网站设置为指向根站点(/ Cranalytics)。

Some Idea to Help. 一些帮助的想法。

1.Check Directory Browsing of your website if it is in enable state or not.
2.Try to separate your project to a new website with different port.
-also configure the newly created web site of course.
3.framework in application pool vs project, it must be the same.

The problem was this site was being update from RC1 to 1.1. 问题是这个站点正在从RC1更新到1.1。 To get RC1 to work there were several things that I needed to undo. 要让RC1工作,我需要撤消一些事情。 In IIS when I created the site I had change the path from the root of the subsite Cranalytics to the wwwroot underneath that. 在我创建网站的IIS中,我已经改变了从子网站Cranalytics的根到其下面的wwwroot的路径。 This had to be undone. 这必须撤消。

Then in the Configure I needed to have something like this because it was a subsite. 然后在配置我需要这样的东西,因为它是一个子网站。 This had to be removed as well. 这也必须删除。

        //if (env.IsDevelopment())
        //{
        //    Configure1(app, env, loggerFactory, context);
        //}
        //else
        //{
        //    app.Map("/Cranalytics", app1 => Configure1(app1, env, loggerFactory, context));
        //}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我发布了我的 ASP.NET Core 6 项目,它发布成功,但是当我 run.exe 文件说 ConnectionString 不能是 null - I published my ASP.NET Core 6 project it published successfully, but when I run .exe file that say ConnectionString cannot be null 从ASP.Net Core 1.1迁移到2.0时BadImageFormatException - BadImageFormatException when migrating from ASP.Net Core 1.1 to 2.0 发布时,Asp.NET Core控制器操作返回404 - Asp.NET Core controller action returns 404 when published ASP.NET Core-发布应用程序后无法使用signInManager登录 - ASP.NET Core - Unable to signIn with signInManager when app is published 发布 ASP.NET 核心时 Serilog 不记录 - Serilog not logging when published ASP.NET core 发布到IIS 7.5时ASP.NET Core 404错误 - ASP.NET Core 404 Error When Published to IIS 7.5 Asp.NET 内核,发布时找不到cshtml的视图 - Asp.NET Core, unable to find View of cshtml when published Azure中的ASP.NET Core 1.1路由 - ASP.NET Core 1.1 routing in Azure 将Webpack与ASP.NET Core 1.1一起使用 - Using Webpack with ASP.NET Core 1.1 等效于 ASP.NET Core 1.1 中的 BindPropertyAttribute - Equivalent to BindPropertyAttribute in ASP.NET Core 1.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM