WebMatrix and DotNetNuke - publishing database to a hosted SQL Server - dotnetnuke

I'm trying to publish a WebMatrix DotNetNuke site to a shared hosting environment. The files publish just fine however publishing the database is causing some issues.
Here is a snippet from the WebMatrix publishing log (I've redacted the actual SQL username and SQL host - the stuff in [square brackets]):
02:03:59: Adding dbFullSql (user id=[username];database=[dbname];server=[server]).
02:03:59: The database '[dbname]' could not be created.
02:03:59: Retrying operation 'Add' on object dbFullSql (user id=[username];database=[dbname];server=[server]). Attempt 1 of 2.
02:03:59: The database '[dbname]' could not be created.
02:03:59: Retrying operation 'Add' on object dbFullSql (user id=[username];database=[dbname];server=[server]). Attempt 2 of 2.
02:03:59: Unable to publish.
02:03:59: Unable to publish. Unable to publish.
02:03:59: Error detail:
02:03:59: (06/02/2011 02:03:59) An error occurred when the request was processed on the remote computer.
02:03:59: at Microsoft.Web.Deployment.StatusThreadHandler.CheckForException()
02:03:59: at Microsoft.Web.Deployment.AgentClientProvider.RemoteDestSync(DeploymentObject sourceObject, DeploymentSyncContext syncContext)
02:03:59: at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable)
02:03:59: at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
02:03:59: at Microsoft.Web.Deployment.DeploymentObject.SyncTo(String provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
02:03:59: at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentWellKnownProvider provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
02:03:59: at Microsoft.WebMatrix.Deployment.MsDeployWorker.Execute(Boolean pullback)
02:03:59: The database '[dbname]' could not be created.
From the log above it's pretty evident that the DotNetNuke WebDeploy package is attempting to create the database. The database already exists and I can connect to it remotely just fine using SQL Management Studio.
Because this is a hosted shared SQL environment the hoster isn't going to permit users to create databases. The SQL Database user/login on the hosted SQL server is the database's dbowner.
Is this a bug in the WebMatrix DNN WebDeploy publishing package?
Are there any workarounds?
This is using WebMatrix 1.0 RTM and the DotNetNuke application downloaded from the WebMatrix Application Gallery. I created a local SQL Express database to prime the DNN site with some content. Everything works great and now I'm trying to publish to the shared host environment where the database is already created.

I haven't used WebMatrix to install DNN, but I have installed many DNN sites manually.
Your publish log says:
02:03:59: The database '' could not be
created.
Did you remove the database name from inside the quotes, or is that exactly as per the log? If the database name is empty then it can not be created. Otherwise, it could be that the ASP.NET worker process (usually named aspnet_wp) does not have any permissions on the SQL Server.
What web host are you using? Some, like godaddy are extremely difficult to install DNN on.

Related

Cannot publish DACPAC to local SQL Server container, external users not valid logins

We have an Azure SQL Server database. I'm trying to implement a better CI/CD workflow by using SQL database projects. I want to create a DACPAC from the production database and apply it to a local container for development.
I've installed the extension Database Projects in Azure Data Studio and I have Docker running.
In the Database Projects extension, create project from database. I select our existing production database in Azure. Folder structure = Schema/Object Type, SDK-Style project enabled.
Build the project. I get 0 errors and 357 warnings. Mostly warnings about that object references differ in case SQL71558 or unresolved references SQL71502.
Publish project to new SQL Server local development container. The docker container is published, but the "Deploy dacpac"-stage fails with error:
Deploy dacpac: Could not deploy package.
Warning SQL0: A project which specifies SQL Server 2019 as the target platform may experience compatibility issues with SQL Server 2017.
Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.
Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 15007, Level 16, State 1, Line 1 'DATAFACTORY' is not a valid login or you do not have permission.
Error SQL72045: Script execution error. The executed script:
CREATE USER [DATAFACTORY] FOR LOGIN [DATAFACTORY];
Go back and change the target platform to Azure SQL Server and build the project again.
Publish the project with the base image set to Azure SQL Database emulator full. Same error:
Deploy dacpac: Could not deploy package.
Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.
Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 15007, Level 16, State 1, Line 1 'DATAFACTORY' is not a valid login or you do not have permission.
Error SQL72045: Script execution error. The executed script:
CREATE USER [DATAFACTORY] FOR LOGIN [DATAFACTORY];
I've also tried adding the master as a database reference. I've tried this in Azure Data Studio, Visual Studio Code and Visual Studio 2019.
According to an answer from the Azure Data Studio team this could be because of a bug that will be fixed in the next release.
To exclude the User Object Type from the publish action to the Docker container, I had to create a DAC Publish Profile in Visual Studio 2019 and then use it when publishing to my local emulator. That particular error disappeared but I've not verified that it's actually resolved since the next error came up.
If anyone else gets a similar problem you can try using this database.publish.xml:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseName>database</TargetDatabaseName>
<DeployScriptFileName>database.sql</DeployScriptFileName>
<ProfileVersionNumber>1</ProfileVersionNumber>
<CreateNewDatabase>True</CreateNewDatabase>
<ExcludeObjectTypes>Users</ExcludeObjectTypes>
</PropertyGroup>
</Project>

EF Core migration on app start fails with "login failed" but works via package manager console

We have multiple applications that use EF Core Code First. Earlier, the databases were created automatically on my local Sql Server 2019 when I first debugged an application locally from Visual Studio 2022. Now that stopped working for some reason and I get the following error message:
Cannot open database "XX" requested by the login. The login failed.
Login failed for user 'Domain\user'.
An example connection string is (I also tried adding Trusted_Connection=True; at the end, doesn't change anything):
Data Source=localhost;Initial Catalog=XX;Integrated Security=true
When I use the package manager console "Update-Database" command, the databases are created as expected and all migrations are executed.
Also, I can create databases with the same user 'Domain\user' via SQL Server Management Studio.
One more thing that I noticed is that I get a different error message if I first create an empty database via SSMS and then start the application. In this case no migrations are performed and the error message is (where Events is some table the application uses):
'Invalid object name 'Events'.'

Migrating Plastic SCM from SQLite to MSSQL Server backend

There is Plastic SCM Server 6.0.16.1765 installed on the development server (MS Windows) with SQLite backend. It needs to migrate the existing repositories to MSSQL Server backend, but something goes wrong.
I followed the instruction step-by-step and it ends up with the error message(at step 7):
The migration progress has failed: The database repositories can't be created. Check the server log (plastic.server.log). Error: Directory lookup for the file "c:\program files\plasticscm5\server\repositories.plastic" failed with the operating system error 3(The system cannot find the path specified.). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I checked as suggested (the server log) and it has the same message as above.
There's no c:\program files\plasticscm5\server\repositories.plastic file or catalog at server - it's true. SQLite data files are located on different place. Why does the plastic migrator check this path?
The repository storage connection is configured using integrated security:
Data Source=MSSQL_SERVER\INSTANCE;Integrated Security=SSPI;DATABASE={0};
Note: the SQLite data files have the extension .sqlite, so it will never find the repositories.plastic file.
After spending some hours, it was found that the problem is in optional parameter Database path. Actually, the parameter must be mandaroty in case of MSSQL Server backend. Neither migration wizard nor the error message gave anything can help. The migration log is missing.

Error authenticating proxy while running agent job

I am trying to schedule a SSIS2014 package via SQL Server Agent job. Both SSIS and SSMS are running on my local machine in the same domain. I am running SSMS with the same user Domain\Admin which is the creator of the SSIS package. SSMS 32-Bit and SSIS 32-Bit are running on Windows 7 64-Bit machine. I can run the package within SSIS without problems.
Using Microsofts KB article http://support.microsoft.com/kb/918760 and tutorial video http://technet.microsoft.com/en-us/library/dd440760%28v=sql.100%29.aspx I tried a couple of methods (proxy, configuration file, EncryptSensitiveWithPassword) but none of them worked for me.
When I use a proxy account to run the job step, the following message occurs:
Unable to start execution of step 1 (reason: Error authenticating proxy
`Domain\Admin`, system error: Logon failure: unknown user name or bad password.).
The step failed.
The proxy account uses the credentials identity Domain\Admin. Since the password fields for credential properties in SSMS cannot be left blank, I typed any password although my corresponding windows account has no password. So as mentioned above it's the same user account that created the SSIS package since Domain\Admin is stated in the CreatorName property of the SSIS package.
With this proxy, I tried to run SSIS jobs using the package ProtectionLevel's EncryptSensitiveWithUserKey and EncryptSensitiveWithPassword. Running the package manually within SSDT without problems, but from SSMS agent job the same error message appears. I tried the package sources "File System" and, after importing the package to MSDB, "SQL Server" and "SSIS Package Store". But exactly the same error message appears with each method.
Task manager shows that SSMS is running in administrator mode. Using Windows Component Services I added DCOM permissions for Domain\Admin to start and activate "Microsoft SQL Server Integration Services 12.0" from local. But the same error message appears. So in my opinion it's a problem with SSMS user account permissions (???) but unfortunately I don't know what exactly to do here. I tried the following:
In the system database MSDB (full path: Databases / System Databases / MSDB / Security / Logins) I assigned all available role memberships (Including db_ssisoperator, db_ssisltduser, db_ssisadmin) to Domain\Admin.
In server security (full path: Security / Logins) I assigned all available server roles. In the tab User Mapping, I assigned the MSDB database.
Still the same error message appears when I try to run the job. Does anybody have some ideas what I can try?

Migration IIS7 site with SQL Server database to another server

I'm using MS Deploy as it's described here but I'm stuck with dbFullSql string format
Data Source=ISSUETRAK\ISSUETRAK_SERVER;Initial Catalog=Issuetrak;User Id=DOMAIN\Administrator;Password=*****;
and getting the following message
Cannot connect to the database 'Issuetrak'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CANNOT_CONNECT_TO_DATABASE.
Object of type 'dbFullSql' and path 'data source=ISSUETRAK\ISSUETRAK_SERVER;initial catalog=Issuetrak;user id=DOMAIN\Administrator' cannot be created.
Failed to connect to server .
Login failed for user 'DOMAIN\Administrator'.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.
Failed to connect to server .
Login failed for user 'DOMAIN\Administrator'.
I've managed to move Web Application using WebDeploy without database. And then I did backup SQL database backup on old server and restore on the new one. Hope that helps anyone.

Resources