Hi, i mande the basic .Net Core App.
Following this steps...
Open VS 2015,
New Project -> .Net Core -> Set the Name 'Test' -> ok,
Web App -> Change Authentication -> Individual User Accounts -> ok -> and Ok again.
Open Packate Manager Console
and write,
PM> Add-Migration 1; Update-Database;
It apeears Done.
Press F5 the app runs, and i make a user on register on up right conner.
Open Microsoft SQL Server Management and press Ok -> LocalDb... -> Databases - aspnet-Test-....
Right click on it -> Tasks -> Baskup
Backup type Full Set path distination and press Ok. It says Ok and i got the file on my desktop.
Open Plesk -> Databases -> Add Database. Set Name User... Then i press Import Dump, chosse file previous created in Sql Studio management.
Publish the VS project to Plesk,
Edit appsettings.json as
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=topelit1_test;uid=AA;pwd=Aaa123;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
and
set web.config as
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Test.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="Off" />
</system.web>
<connectionStrings>
<remove name="LocalSqlServer" />
</connectionStrings>
</configuration>
Go to the url of the web app right up conner and try to make login, and i recibe this error.
A database operation failed while processing the request.
SqlException: Cannot open database "topelit1_test" requested by the login. The login failed. Login failed for user 'CP82\IWPD_4(topelit1)'.
Applying existing migrations for ApplicationDbContext may resolve this issue
There are migrations for ApplicationDbContext that have not been applied to the database
In Visual Studio, you can use the Package Manager Console to apply pending migrations to the database:
PM> Update-Database
Alternatively, you can apply pending migrations from a command prompt at your project directory:
> dotnet ef database update
How can i solve this?
Thanks.
Following this steps...
Open VS 2015,
New Project -> .Net Core -> Set the Name 'Test' -> ok,
Web App -> Change Authentication -> Individual User Accounts -> ok -> and Ok again.
Open Packate Manager Console
and write,
PM> Add-Migration 1; Update-Database;
It apeears Done.
Press F5 the app runs, and i make a user on register on up right conner.
Open Microsoft SQL Server Management and press Ok -> LocalDb... -> Databases - aspnet-Test-....
Right click on it -> Tasks -> Baskup
Backup type Full Set path distination and press Ok. It says Ok and i got the file on my desktop.
Open Plesk -> Databases -> Add Database. Set Name User... Then i press Import Dump, chosse file previous created in Sql Studio management.
Publish the VS project to Plesk,
Edit appsettings.json as
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=topelit1_test;uid=AA;pwd=Aaa123;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
and
set web.config as
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Test.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="Off" />
</system.web>
<connectionStrings>
<remove name="LocalSqlServer" />
</connectionStrings>
</configuration>
Go to the url of the web app right up conner and try to make login, and i recibe this error.
A database operation failed while processing the request.
SqlException: Cannot open database "topelit1_test" requested by the login. The login failed. Login failed for user 'CP82\IWPD_4(topelit1)'.
Applying existing migrations for ApplicationDbContext may resolve this issue
There are migrations for ApplicationDbContext that have not been applied to the database
- 00000000000000_CreateIdentitySchema
- 20170111181401_1
In Visual Studio, you can use the Package Manager Console to apply pending migrations to the database:
PM> Update-Database
Alternatively, you can apply pending migrations from a command prompt at your project directory:
> dotnet ef database update
How can i solve this?
Thanks.