ASP.NET 5(vNext)在Azure上导致500 - 内部服务器错误

时间:2022-11-24 08:36:30

We are working on a project with the new ASP.NET 5 (vNext), EF7 and AngularJS and plan to deploy the WebApp on Azure.

我们正在使用新的ASP.NET 5(vNext),EF7和AngularJS开发一个项目,并计划在Azure上部署WebApp。

I've created a new Web Application on Azure and published our project via Visual Studio 2015. After publishing I'll get a 500 - Internal Server Error when I try to test our application.

我在Azure上创建了一个新的Web应用程序,并通过Visual Studio 2015发布了我们的项目。发布后,当我尝试测试我们的应用程序时,我会得到500 - 内部服务器错误。

I've already set <customErrors mode="Off" /> in the web.config in wwwroot without success. I've then logged in via FTP and the "DetailedErrors" also do not contain any useful information.

我已经在wwwroot的web.config中设置了 但没有成功。我已经通过FTP登录,“DetailedErrors”也没有包含任何有用的信息。

The eventlog.xml contains following exception:

eventlog.xml包含以下异常:

<Events><Event><System><Provider Name="ASP.NET 4.0.30319.0"/>    <EventID>1309</EventID><Level>2</Level><Task>0</Task>    <Keywords>Keywords</Keywords><TimeCreated SystemTime="2015-07-28T10:54:43Z"/>    <EventRecordID>280293125</EventRecordID><Channel>Application</Channel>    <Computer>RD000D3A202052</Computer><Security/></System><EventData>    <Data>3005</Data><Data>An unhandled exception has occurred.</Data>    <Data>7/28/2015 10:54:43 AM</Data><Data>7/28/2015 10:54:43 AM</Data>    <Data>9df086471c304ebfa4ddddf9ca2a2b92</Data><Data>1</Data><Data>1</Data><Data>0</Data><Data>/LM/W3SVC/2082809257/ROOT-1-130825544829782705</Data><Data></Data><Data>/</Data><Data>D:\home\site\wwwroot\</Data><Data>RD000D3A202052</Data><Data></Data><Data>2108</Data><Data>w3wp.exe</Data><Data>IIS APPPOOL\appname</Data><Data>InvalidOperationException</Data><Data>Couldn't determine an appropriate version of runtime to run. See http://go.microsoft.com/fwlink/?LinkId=517742 for more information.
at AspNet.Loader.RuntimeLocator.LocateRuntime(MapPathHelper mapPathHelper, Boolean&amp; isCoreClr, String&amp; relativeAppBasePath)
at AspNet.Loader.Bootstrapper.LoadApplication(String appId, String appConfigPath, IProcessHostSupportFunctions supportFunctions, LoadApplicationData* pLoadAppData, Int32 loadAppDataSize)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Web.Hosting.ProcessHost.System.Web.Hosting.IProcessHostLite.ReportCustomLoaderError(String appId, Int32 hr, AppDomain newlyCreatedAppDomain)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

It says that it couldn't determine an appropriate version of the runtime.

它说它无法确定运行时的适当版本。

In the project properties the solution DNX SDK version is set to:

在项目属性中,解决方案DNX SDK版本设置为:

  • 1.0.0-beta4
  • 1.0.0-BETA4
  • .NET Framework
  • .NET Framework
  • x86
  • 86

The frameworks set in project.json:

project.json中设置的框架:

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
},

How can I get more information on the error?

如何获得有关错误的更多信息?

1 个解决方案

#1


3  

I was able to re-create your problem. Turns out that the publish wizard selects a runtime by default that doesn't match the selected DNX runtime of the app. You can fix this by going into the publish settings and selecting the correct Target DNX Version in the dropdown. In your case: the beta4 core-clr version.

我能够重新创建你的问题。事实证明,发布向导默认选择与应用程序的选定DNX运行时不匹配的运行时。您可以通过进入发布设置并在下拉列表中选择正确的目标DNX版本来解决此问题。在您的情况下:beta4 core-clr版本。

After file > new project - my project.json looked like:

在文件>新项目之后 - 我的project.json看起来像:

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
},  

NOTE - it's using core - the core clr - not the full CLR. While setting up the publishing for this app - It jumped over the default settings here:

注意 - 它使用核心 - 核心clr - 而不是完整的CLR。在为此应用设置发布时 - 它跳过默认设置:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE - by default it selected the dnx-clr, not core-clr. Beta5 version is correct though.

注 - 默认情况下,它选择了dnx-clr,而不是core-clr。虽然Beta5版本是正确的。

Publishing resulted in an Internal Server error:

发布导致内部服务器错误:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

I found the error description here:

我在这里找到了错误描述:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE: this requires the new Azure 2.7 SDK to be installed.

注意:这需要安装新的Azure 2.7 SDK。

The interesting part of this message is:

这条消息的有趣部分是:

<Data>DirectoryNotFoundException</Data>
<Data>Unable to find the runtime directory 'D:\home\site\wwwroot\..\approot\runtimes\dnx-clr-win-x86.1.0.0-beta5-12103'. 
Possible causes:
1. The runtime was not packaged with the application.
2. The packaged runtime architecture is different from the application pool architecture. 
... </Data>

So I switched to the correct Target DNX version and it worked:

所以我切换到正确的Target DNX版本并且它有效:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE - the coreclr version.

注 - coreclr版本。

#1


3  

I was able to re-create your problem. Turns out that the publish wizard selects a runtime by default that doesn't match the selected DNX runtime of the app. You can fix this by going into the publish settings and selecting the correct Target DNX Version in the dropdown. In your case: the beta4 core-clr version.

我能够重新创建你的问题。事实证明,发布向导默认选择与应用程序的选定DNX运行时不匹配的运行时。您可以通过进入发布设置并在下拉列表中选择正确的目标DNX版本来解决此问题。在您的情况下:beta4 core-clr版本。

After file > new project - my project.json looked like:

在文件>新项目之后 - 我的project.json看起来像:

"frameworks": {
    "dnx451": { },
    "dnxcore50": { }
},  

NOTE - it's using core - the core clr - not the full CLR. While setting up the publishing for this app - It jumped over the default settings here:

注意 - 它使用核心 - 核心clr - 而不是完整的CLR。在为此应用设置发布时 - 它跳过默认设置:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE - by default it selected the dnx-clr, not core-clr. Beta5 version is correct though.

注 - 默认情况下,它选择了dnx-clr,而不是core-clr。虽然Beta5版本是正确的。

Publishing resulted in an Internal Server error:

发布导致内部服务器错误:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

I found the error description here:

我在这里找到了错误描述:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE: this requires the new Azure 2.7 SDK to be installed.

注意:这需要安装新的Azure 2.7 SDK。

The interesting part of this message is:

这条消息的有趣部分是:

<Data>DirectoryNotFoundException</Data>
<Data>Unable to find the runtime directory 'D:\home\site\wwwroot\..\approot\runtimes\dnx-clr-win-x86.1.0.0-beta5-12103'. 
Possible causes:
1. The runtime was not packaged with the application.
2. The packaged runtime architecture is different from the application pool architecture. 
... </Data>

So I switched to the correct Target DNX version and it worked:

所以我切换到正确的Target DNX版本并且它有效:

ASP.NET 5(vNext)在Azure上导致500  - 内部服务器错误

NOTE - the coreclr version.

注 - coreclr版本。