发布.net核心2.0网站时的HTTP 500

时间:2017-11-22 03:23:04

标签: javascript c# asp.net azure asp.net-core

将.net core 2.0网站发布到Azure或本地IIS时,发布过程会通过,但在打开我收到的网站时HTTP ERROR 500

要查看背后的真实错误,我将已发布网站的web.config修改为:

   <aspNetCore processPath="dotnet" arguments=".\OurWebApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
     <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
  </aspNetCore>

背后的错误是:

InvalidOperationException: No service for type 'Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet' has been registered.

1 个答案:

答案 0 :(得分:2)

解决方案是从布局页面中删除以下内容,例如_Layout.cshtml:

@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet

@Html.Raw(JavaScriptSnippet.FullScript)

然后再次发布