发布到 Azure 后无法使 MVC 站点工作?

Can't make MVC site work after publishing to Azure?

我有一个完美运行的 MVC 项目(本地),但是在我将它发布到 Azure 之后(通过下载 Azure 发布配置文件,导入它并发布),每当我对上传的项目执行操作时,我只会看到一个标准错误屏幕需要与数据库联系的站点。喜欢登录或搜索网站上的其他资料。

它只是给我一个简单的 "An error has occurred" 消息,没有详细说明问题是什么?我尝试在服务器上启用详细的错误消息,但它并不关心它只是给出相同的错误消息而没有任何解释。

我尝试了通过搜索引擎找到的各种东西。但我无法确定我的问题。我怀疑它与服务器上的 Web 配置文件有关吗?但我不能确定。

更新:我现在实际上是 post 具体问题,而不是一般消息,似乎由于某种原因,没有创建使用身份框架时创建的普通表?哪个对我来说很奇怪?我的意思是我确实将我拥有的两个不同的 dbcontext classes 合并到标准 ApplicationDbContext class 中,但在本地它仍然存储了所有用户等。为什么当我发布它时它不再创建这些表了?

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <connectionStrings>
   // REMOVED SENSITIVE INFO
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <authentication mode="None" />
    <compilation targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
    <staticContent>
      <remove fileExtension=".svg" />
      <remove fileExtension=".eot" />
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
      <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
      <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
    </staticContent>

  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
    <contexts>
      <context type="MEV3.Models.ApplicationDbContext, MEV3">
        <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[MEV3.Models.ApplicationDbContext, MEV3], [MEV3.Migrations.Configuration, MEV3]], EntityFramework, PublicKeyToken=b77a5c561934e089">
          <parameters>
            <parameter value="DefaultConnection_DatabasePublish" />
          </parameters>
        </databaseInitializer>
      </context>
    </contexts>
  </entityFramework>

</configuration>

这个答案和问题中所选答案下方的答案 - 结合 - 拯救了我,让一切顺利进行!非常感谢我偶然发现了这个。

How to re-create database for Entity Framework?