Web Deploy ASP.NET Core i EF na webio.pl

0

Próbuję umieścić swoją aplikację webową na serwerze webio.pl za pomocą Publish -> Web Deploy w Visual Studio 2017.

Niestety występuje błąd i publikacja nie dochodzi do skutku i powoli zaczyna brakować mi pomysłów co robię źle. Posiadam ostatnią wersję SDK Core, target framework dla aplikacji to .NET Core 2.1, connection strings dla baz (aplikacji oraz identity):
<add name="DefaultConnection" connectionString="Data Source=mssql6.webio.pl,2401;Database=bakunet_strona;Uid=NAZWA;Password=HASŁO" providerName="System.Data.SqlClient" xmlns="" /> <add name="DefaultConnection" connectionString="Data Source=mssql6.webio.pl,2401;Database=bakunet_identity;Uid=NAZWA;Password=HASŁO;" providerName="System.Data.SqlClient" xmlns="" />

Przy okazji, przy próbie migracji z konsoli komendą dotnet ef database update --context ApplicationDbContext lub dotnet ef database update --context AppIdentityDbContext otrzymuję komunikat błędu: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - Łańcuch certyfikatów został wystawiony przez urząd, którego nie jest zaufany.)

Bazy są uwtorzone przy użyciu SQL Server Manager 17.

Przy próbie publikacji aplikacji na serwer przy wykorzystaniu Web Deploy na koniec otrzymuję komunikaty błędów:
C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ObsoleteReferences.targets(33,5): Warning NETSDK1059: The tool 'Microsoft.EntityFrameworkCore.Tools.DotNet' is now included in the .NET Core SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). Strona -> C:\Users\asus\Desktop\Praca IT\Programowanie\Projekty\Strona\Webio\Strona\bin\Release\netcoreapp2.1\Strona.dll Strona -> C:\Users\asus\Desktop\Praca IT\Programowanie\Projekty\Strona\Webio\Strona\obj\Release\netcoreapp2.1\PubTmp\Out\ Generating Entity framework SQL Scripts... Executing command: dotnet ef migrations script --idempotent --output "C:\Users\asus\Desktop\Praca IT\Programowanie\Projekty\Strona\Webio\Strona\obj\Release\netcoreapp2.1\PubTmp\EFSQLScripts\Strona.Models.AppIdentityDbContext.sql" --context Strona.Models.AppIdentityDbContext Executing command: dotnet ef migrations script --idempotent --output "C:\Users\asus\Desktop\Praca IT\Programowanie\Projekty\Strona\Webio\Strona\obj\Release\netcoreapp2.1\PubTmp\EFSQLScripts\Strona.Models.ApplicationDbContext.sql" --context Strona.Models.ApplicationDbContext Generating Entity framework SQL Scripts completed successfully Adding sitemanifest (sitemanifest). Adding child sitemanifest (C:\Users\asus\Desktop\Praca IT\Programowanie\Projekty\Strona\Webio\Strona\obj\Release\netcoreapp2.1\PubTmp\EFSQLScripts\Strona.Models.AppIdentityDbContext.sql). C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): Error : Web deployment task failed. (Make sure the database connection string for the server is correct and that you have appropriate permission to access the database. (Web Deploy Provider is "dbFullSql"). Error details:Could not complete an operation with the specified provider ("dbFullSql") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. dbFullSql http://go.microsoft.com/fwlink/?LinkId=178034 Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_DBFULLSQL.) Publish failed to deploy.

Czekam na feedback od supportu. Ale może Wy będziecie mieli jakieś pomysły?

Testowo z sukcesem udało mi się wrzucić aplikację bez dostępu do baz.

1

Dla potomnych, spróbowałem publikować aplikację bez podawania ConnectionString w ustawieniach w panelu Publish Visual Studio (bazy już były wcześniej tworzone przez SQL Server Manager, nie trzeba było ich już migrować przy publikacji),

otrzymałem komunikat, który został opisany w zapytaniu na SO: https://stackoverflow.com/questions/17615260/the-certificate-chain-was-issued-by-an-authority-that-is-not-trusted-when-conn

W rozwiązaniu jest wyjaśnione, że w pliku appsettings.production.json należy zamienić TrustServerCertificate=False na TrustServerCertificate=True. Podejrzewam, że jest to związane z zabezpieczeniami SSL serwerów Webio. Miałem domyślnie False, co działało bez zarzutów na moim testowym koncie Azure.

Po ponownej publikacji bez podawania ConnectionString (bez migracji baz przy publikacji), aplikacja działa już bez zarzutów.

Nawiązując do konsolowego komunikatu po wpisaniu dotnet ef database update wydaje mi się, że był on także powodowany konfiguracją TrustServerCertificate=False.

1 użytkowników online, w tym zalogowanych: 0, gości: 1