Error when restoring external application bank asp.net mvc

0

I am trying to restore a SQL database that I created in a provider that does not have the WebDeploy option. And my goal is to initialize a database using ASP.NET MVC with EntityFramework . Well, when setting the server and password settings, the bank appears in my SQL Management But it was different, in the icon where it usually turns green, it is gray follows an image to illustrate better.

WhenrestoringDBIhaveonemoreerror,followtheimage:

Whatisthiserror?

HowdoIresolveit?

WhileIwasdevelopingtheapplication,withCodeFirstIusedthefollowingConnectionStringsinmyWebConfig

<connectionStrings><addname="VendasDeTitulos" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VendasDeTitulos;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

How will I be in the configuration to use with the Provider bank?

    
asked by anonymous 17.05.2017 / 01:59

1 answer

1
The connection string needs to look like this:

<connectionStrings>
  <add name="VendasDeTitulos" connectionString="Data Source=mssql913.umbler.com,5003;Initial Catalog=VendasDeTitulos;User Id=usuario;Password=senha" providerName="System.Data.SqlClient" />
</connectionStrings>

Do not restore the database manually. The application should do this.

Make sure your Web.config has the following at the time of publication:

<configuration>
  ...
  <entityFramework>
    <contexts>
      <context type="MeuProjeto.Models.MeuProjeto, MeuProjeto" disableDatabaseInitialization="false">
        <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion'2[[MeuContexto, MeuProjeto], [Configuration, MeuProjeto]], EntityFramework" />
        </context>
      </contexts>
   </entityFramework>
<configuration>

Or initialize your base by code:

public MeuContexto()
    : base()
{
    Database.SetInitializer<MeuContexto>(new MigrateDatabaseToLatestVersion<MeuContexto, Configuration>());
}
    
17.05.2017 / 02:43