发布后的内部服务器错误和未创建的表

问题描述 投票:0回答:2

此问题仅出现在我发布的服务器上。在当地,我没有问题。

从VS2017发布后,该网页显示内部服务器错误,该页面上没有进一步说明。这不是我第一次发表,所以这个问题非常随意。

我在我的智慧结束,我完全被这导致了什么。特别是在我发布之前,它工作正常。虽然,自从我从VS发表以来已经有一段时间了。

我试过的事情:

  • 重新启动服务器
  • 修复IIS并确保安装正确的.net核心版本。
  • 更多服务器重启
  • 确保存在正确的DLL(即使这不是第一次发布)
  • 检查appsettings中的连接字符串
  • 查看stdoutLog输出
  • 查看事件日志 - 这没有显示任何有用的信息

stdoutLog堆栈跟踪如下:

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile not available. Using 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\AutoGenKeys\S-1-5-82-1102471511-930544150-2645822985-2987586966-3557056008\DataProtection' as key repository and Windows DPAPI to encrypt keys at rest.
Application startup exception: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: providerInvariantName
   at Serenity.Data.DbProviderFactories.GetFactory(String providerInvariantName)
   at Serenity.Data.SqlConnections.GetFactory(String providerName)
   at Serenity.Data.ConnectionStringInfo.get_ProviderFactory()
   at ApexCore.DataMigrations.EnsureDatabase(String databaseKey) in DataMigrations.cs:line 40
   at ApexCore.DataMigrations.Initialize() in DataMigrations.cs:line 27
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception

正如你所看到的,它说的是在DataMigrations.cs中抛出错误。这并不完全有意义,因为在那里有很长一段时间没有变化。抛出错误的区域超出了创建数据库表的位置。因此,由于表不存在,因此迁移失败是有意义的。

所以,总结一下......网站将在最新发布后加载。不在数据库中创建表,因为它们应该是。连接字符串是正确的,没有出现错误,说它无法连接。

我想要提到的一件事是,当在Connection Strings下查看IIS管理器时,我注意到它已经没有任何东西了。这不是假设在我的AppSettings中自动填充了什么?

c# .net-core runtime-error ef-migrations publishing
2个回答
0
投票

您可以通过在程序和功能中修复iis服务器来解决此问题。 请阅读这个答案。它可能会帮助你 Specified argument was out of the range of valid values. Parameter name: site


0
投票

经过多次崩溃后,当我发布发布模式时,网站无法运行。但如果我在调试模式下发布,一切都很好。这是一个临时解决方案,但它现在必须要做。我将不得不研究为什么发布模式被破坏了。

© www.soinside.com 2019 - 2024. All rights reserved.