jga*_*fin 1 c# azure asp.net-core-mvc asp.net-core-mvc-2.0
我已将我的应用程序从ASP.NET Core v1.1更新为ASP.NET Core 2.0.
在我的开发机器上一切正常.但是当我部署到Azure时,我得到"HTTP Error 502.5 - Process Failure"了回复.
我在web.config中激活了日志记录:
<aspNetCore processPath=".\PublicWeb2.Web.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
Run Code Online (Sandbox Code Playgroud)
日志说:
无法初始化CoreCLR,HRESULT:0x80004005
如果我dotnet mysite.dll从Kudo的命令提示符运行,我会得到相同的错误.
Azure中的事件日志提供以下错误:
物理根"D:\ home\site\wwwroot \"的应用程序"MACHINE/WEBROOT/APPHOST/XXXXX"无法使用命令行"D:\ home\site\wwwroot\XXX"启动进程,ErrorCode ='0x80004005:80008089.
相关的Azure设置:
我完整的csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<UserSecretsId>XXXXXXXXXXX</UserSecretsId>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MarkdownWeb" Version="1.3.4" />
<PackageReference Include="MarkdownWeb.Git" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XXX\XXX.csproj" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
安装在云服务上的Dotnet版本:
D:\home\site\wwwroot>dotnet --info
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 6.2.9200
OS Platform: Windows
RID: win8-x86
Base Path: D:\Program Files (x86)\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Run Code Online (Sandbox Code Playgroud)
我做了什么(从阅读其他SO问题):
win7-x86为我的csproj中的第一个运行时标识符COREHOST_TRACE=1激活,但然后控制台挂在工具(和管道到日志不起作用,即dotnet myapp.dll > mylog.txt)我不知道接下来该做什么.
终于搞定了.
在webproject的csproj文件中,我删除了<RuntimeIdentifiers>元素(<RuntimeIdentifier>如果你指定了一个运行时那就是它).
<RuntimeIdentifier>在发布配置文件中删除.pubxml可以在解决方案资源管理器中找到
Project -> Properties -> PublishProfiles -> yourfilename.pubxml.
Run Code Online (Sandbox Code Playgroud)
删除以下行(指定了运行时)
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
Run Code Online (Sandbox Code Playgroud)
保存文件并关闭它.
下次运行publish命令时,它应该在Settings选项下说"portable" :
这对我有用.
因此,我的猜测是真正的解决方案是:
RuntimeIdentifier在发布配置文件中指定了noRuntimeIdentifiercsproj文件中未指定no| 归档时间: |
|
| 查看次数: |
1975 次 |
| 最近记录: |