【问题标题】:Internal Server Error after publishing and Tables not being created发布后内部服务器错误且未创建表
【发布时间】:2019-08-31 03:06:52
【问题描述】:

此问题仅出现在我发布到的服务器上。在本地,我的问题为零。

从 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 中出现错误。这并不完全有意义,因为在很长一段时间内那里的变化为零。引发错误的区域超出了创建数据库表的位置。因此,由于表不存在,因此迁移失败是有道理的。

所以,总结一下...网站在最新发布后将无法加载。表没有按照应有的方式在数据库中创建。连接字符串是正确的,并且没有出现无法连接的错误。

我想提一提的是,在 IIS 管理器中的连接字符串下查看时,我注意到那里什么都没有了。这不是假设会自动填充我的AppSettings 中的内容吗?

【问题讨论】:

    标签: c# .net-core runtime-error entity-framework-migrations publishing


    【解决方案1】:

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

    【讨论】:

    【解决方案2】:

    经过多次崩溃,事实证明,当我发布发布模式时,该网站将无法运行。但是如果我在调试模式下发布,一切都很好。这是一个临时修复,但现在必须这样做。我将不得不研究为什么发布发布模式会被破坏。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-11
      • 1970-01-01
      • 2015-11-16
      相关资源
      最近更新 更多