【发布时间】:2022-02-22 01:38:47
【问题描述】:
我正在发布一个没有内容(即直接开箱即用)的 ASP.NET Core 3.1 Web 应用程序,并且在尝试运行网站时出现标题错误。
我在“发布”中使用文件夹配置文件选项。
不寻常的是已发布文件夹的内容 - 文件夹是:
cs de es;
等包括
wwwroot; zh-hans; zh-hant; appsettings.development.json
appsettings.json
Microsoft.AspNetCore.Mvc.Razor.Extensions.dll
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.dll
Microsoft.AspNetCore.Razor.Language.dll
Microsoft.CodeAnalysis.CSharp.dll
Microsoft.CodeAnalysis.dll
Microsoft.CodeAnalysis.Razor.dll
Microsoft.Extensions.DependencyModel.dll
System.Text.Json.dll
web.config
WebTest.deps.json
WebTest.dll
WebTest.exe
WebTest.pdb
WebTest.runtimeconfig.json
WebTest.Views.dll
WebTest.Views.pdb
web.config 文件是:
<?xml version="1.0" encoding="utf-8"?
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\WebTest.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
!--ProjectGuid: FAD94D81-0B07-4B20-8215-9AD183B65D61--
我尝试了各种选项更改,但没有任何效果。
任何帮助将不胜感激,谢谢
进一步了解您的 cmets:
从 IIS 管理器运行错误是:
*
HTTP 错误 500.19 - 内部服务器错误
请求的页面无法访问,因为该页面的相关配置数据无效。
错误代码 0x8007000d
配置错误
*
再次发布:
设置 target = win-x64 而不是 Portable
自成体系
* 我按照建议运行了 dotnet webtest.dll 并没有出现明显的错误。 再次从 IIS 管理器运行并得到同样的错误!
C:\Temp\WebDemos\AnnaMayTestFolder>dotnet webtest.dll
dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
dbug: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[37]
Reading data from file 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys\key-5f27c4fc-fa29-4712-a66e-a5c00fd8c31c.xml'.
dbug: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[37]
Reading data from file 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys\key-a07760bd-83a7-4ff1-963d-370c2bbee546.xml'.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
Found key {5f27c4fc-fa29-4712-a66e-a5c00fd8c31c}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
Found key {a07760bd-83a7-4ff1-963d-370c2bbee546}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver[13]
Considering key {a07760bd-83a7-4ff1-963d-370c2bbee546} with expiration date 2020-09-05 18:58:12Z as default key.
dbug: Microsoft.AspNetCore.DataProtection.TypeForwardingActivator[0]
Forwarded activator type request from Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor, Microsoft.AspNetCore.DataProtection, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 to Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor, Microsoft.AspNetCore.DataProtection, Culture=neutral, PublicKeyToken=adb9793829ddae60
dbug: Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor[51]
Decrypting secret element using Windows DPAPI.
dbug: Microsoft.AspNetCore.DataProtection.TypeForwardingActivator[0]
Forwarded activator type request from Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 to Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Culture=neutral, PublicKeyToken=adb9793829ddae60
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[4]
Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[3]
Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[2]
Using key {a07760bd-83a7-4ff1-963d-370c2bbee546} as the default key.
dbug: Microsoft.AspNetCore.DataProtection.Internal.DataProtectionHostedService[0]
Key ring with default key {a07760bd-83a7-4ff1-963d-370c2bbee546} was loaded during application startup.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[2]
Failed to locate the development https certificate at '(null)'.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[0]
Using development certificate: CN=localhost (Thumbprint: 5D0B4342CC4EAD5ED23E1752F64EC374F9EE941C)
dbug: Microsoft.AspNetCore.Server.Kestrel[0]
No listening endpoints were configured. Binding to http://localhost:5000 and https://localhost:5001 by default.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[0]
Loaded hosting startup assembly WebTest
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
信息:Microsoft.Hosting.Lifetime[0] 托管环境:生产 信息:Microsoft.Hosting.Lifetime[0] 内容根路径:C:\Temp\WebDemos\AnnaMayTestFolder dbug:Microsoft.Extensions.Hosting.Internal.Host[2] 托管开始
* 任何人都可以确认上面显示的 Publish Target 输出文件夹结构是典型的吗?在我看来完全错误!典型的已发布文件夹会是什么样子?这是我第一次尝试建立一个网站。
在这个问题上尽我所能进行研究后,我现在完全被难住了。如果有人可以进一步提供帮助,那就太好了。
【问题讨论】:
-
我已经检查了应用程序和 iis 应用程序池中的位数;用户/系统/等的文件夹安全访问。现在在黑暗中跌跌撞撞!
-
从控制台运行应用程序并检查错误。更改
appsettings.json内的LogLevel -
添加错误,没有它我们无法知道发生了什么。
-
看看你是否安装了.net core 3.1 sdk。有一次我没有在服务器上安装正确的 sdk。
-
从 IIS 运行管理错误是: * HTTP 错误 500.19 - 内部服务器错误 请求的页面无法访问,因为该页面的相关配置数据无效。错误代码 0x8007000d 配置错误 * 再次发布:set target = win-x64 而不是 Portable Self-contained * 我按照建议运行了 dotnet webtest.dll(请参阅下一条评论)并且没有明显错误。再次从 IIS 管理器运行并得到同样的错误!
标签: c# asp.net-core