ASP.NET MVC3 webdeploy: database deployment on production - asp.net-mvc-3

I am using webdeploy to deploy my web application to IIS. I followed Microsoft's 12 part tutorial for this. I successfully deployed it on my local IIS.
I have to now deploy this to production and I am following the same steps. I am connected to the remote machine via VP. Form VS2010 publish profile the connection to the server was successful. But when I enter the DB connection string as
"Data Source=xxxx\SQLExpress;Initial Catalog=SWSS;Integrated Security=True"
and try to preview the Database, I get the following error:
Web deployment task failed. ((4/1/2013 9:18:42 PM) An error occurred when the request was processed on the remote computer.)
(4/1/2013 9:18:42 PM) An error occurred when the request was processed on the remote computer.
Exception has been thrown by the target of an invocation.
Member 'ClassName' was not found.
The remote machine does not have TCP/IP enabled.
1. Is it safe to enable this in production machine?
2. If not, how to deploy DB, taking advantage of the dbdacfx?
Update 1:
Based on the comments below, I have changed my connection string as follows:
"Data Source=SWSS\SQLExpress;Initial Catalog=SWSS;User Id=xxxx;Password=xxxx;"
I created a sysadmin user in SQL server with SQL authentication rather than Windows authentication. Now the error is as follows:
Web deployment task failed. (Could not generate deployment script.
Unable to connect to target server.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.)
Update 2:
Using mixed mode authentication on SQL Server fixed my issue.

Related

Orcale Database connection failure from VS-2022

I am suddenly unable to get connected to the Oracle database from VisualStudio 2022.
The latest build is also not working after the deployment on the deployment server, I cannot see any changes in my checkout files related to the connection string but the previously hosted build is working perfectly at the deployment server.
However, I am still able to connect from SqlDeveloper.
(The only change that I can observe is the windows update)
"DefaultDb": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))(CONNECT_DATA=(SERVICE_NAME=)));User Id=;Password=;"
Error: ORA-12545: Network Transport: Unable to resolve connect hostname'

Local Db failure on initialization of template

I'm trying to setup a startup template to play around with boilerplate and see what it could potentially offer and I'm running into issues setting up my local database.
I've tried the core startup template download as well as MVC 5 and they've both given me the same issue so far. I'll open up the solution in VS 2017, clean the solution, rebuild, enter Package Manager Console and execute Update-Database on the EntityFramework project and I get this error on both projects,
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:2,State:0,Class:20
A network-related or instance-specific error occurred while establishing
a connection to SQL Server. The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured
to allow remote connections. (provider: Named Pipes Provider, error: 40 -
Could not open a connection to SQL Server)
I'm having a hard time understanding what this might be indicating. I'm pretty sure I've been able to use my local db in other projects recently.
You need to set up an empty database and provide a valid connection string in appsettings.json.
You can use Microsoft's SQL Server.

Visual Studio webdeploy fail even when connection is validated?

I am trying to deploy my webapp VS2015 RC1 DNX 451. Even when I validate connection and run publish I get error
Severity Code Description Project File
Error Error Code: ERROR_USER_UNAUTHORIZED
Error More Information: Connected to the remote computer ("crocus.arvixe.com") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error Error: The remote server returned an error: (401) Unauthorized.
Googling the issue and even trying to view host forum just says make sure username and password is correct. I am getting nowhere trying various settings. Any ideas how to debug the issue?
I am using Arvixe.com as host.
You should contact Arvixe.com. They likely have some odd configuration on their servers but I would suspect they can help you resolve the issue.
Arvixe does not support Web Deploy anymore. Once they move you to their new servers Web Deploy won't be available to you. In Visual Studio you can set up a Publish with FTP instead of Web Deploy. If you're used to Web Deploy publishing your database changes, then you'll need to do those yourself with SQL scripts. Entity Frameworks has an option to produce a SQL script for a migration, so you can use that to publish your EF database changes.

IIS 7 Cannot Create ASPNETDB.MDF

I have a web application that uses a local SQL Server Express database (a.k.a. ~/App_Data/ASPNETDB.MDF).
When I deploy to IIS 7.0 on Windows 2008 Standard (SP2), I get the error:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
The error message goes on to offer some advice
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance
using a database location within the application's App_Data directory.
The provider attempted to automatically create the application
services database because the provider determined that the database
does not exist. The following configuration requirements are necessary
to successfully check for existence of the application services
database and automatically create the application services database:
If the application is running on either Windows 7 or Windows Server
2008R2, special configuration steps are necessary to enable
automatic creation of the provider database. Additional information
is available at: http://go.microsoft.com/fwlink/?LinkId=160102. If
the application's App_Data directory does not already exist, the web
server account must have read and write access to the application's
directory. This is necessary because the web server account will
automatically create the App_Data directory if it does not already
exist.
If the application's App_Data directory already exists, the web
server account only requires read and write access to the
application's App_Data directory. This is necessary because the web
server account will attempt to verify that the Sql Server Express
database already exists within the application's App_Data directory.
Revoking read access on the App_Data directory from the web server
account will prevent the provider from correctly determining if the
Sql Server Express database already exists. This will cause an error
when the provider attempts to create a duplicate of an already
existing database. Write access is required because the web server
account's credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a
local user profile for both machine and domain accounts.
I don't understand how to troubleshoot 4. (where can I find the "readme document"?). However, the other items look correct to me.
Specifically...
The app pool in question is running as NETWORK SERVICE (not Application Pool Identity)
The user NETWORK SERVICE has Full Control of App_Data (do I understand correctly that it does NOT need Read/Write for App_Data's parent, since App_Data is already created?)
Interestingly, if I copy ASPNETDB.MDF and ASPNETDB.LDF from my development machine to the production App_Data, the error changes:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified) Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.Data.SqlClient.SqlException: A
network-related or instance-specific error occurred while establishing
a connection to SQL Server. The server was not found or was not
accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
What am I missing?
I had the same error before and the problem was that my SQL Server service was stopped, this is pretty weird but sometimes they just crash,I had to reinstall SQL Server cause the service didn't even alloud me to start it,so you may want to check this.
I ended up moving the relevant tables to a new SQL Server database because I could not resolve the permissions issue.
That is the recommended approach anyhow for a production application, though it seems unfortunate that it was so hard (in terms of determining how to configure security) to deploy the ASPNETDB.MDF variant for a very low-volume website.

WebDeploy - just can't get it to work

I've installed Web Deploy 2.1 on a Server 2008 R2 running under VMWare.
In the IIS Manager (Management Service applet) I can see that "Enable Remote Connections" is checked and the port is set to 8172. Under "IIS Manager Permissions" I've added my Windows account (CORP\ekkis) and under the "Authentication" applet (for IIS) I have enabled "Windows Authentication".
I've also turned off the firewall.
So from the command line I test the system to work like this:
C:\Program Files\IIS\Microsoft Web Deploy V2>msdeploy -verb:dump -source:contentPath=\temp,wmsvc=192.168.0.70,username=CORP\ekkis,password=MyPass,authType=Basic -allowUntrusted=True
and get this:
Info: Using ID '9b954a0f-ff07-4e77-ba2c-d27472f5fda0' for connections to the rem
ote server.
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("192.168.0.70") using t
he Web Management Service, but could not authorize. Make sure that you are using
the correct user name and password, that the site you are connecting to exists,
and that the credentials represent a user who has permissions to access the sit
e.
Error: Object of type 'contentPath' and path '\temp' cannot be created.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
I've also tried deploying with Visual Studio 2010 from the host OS with the following service urls (I haven't found proper documentation on how to form this url):
https://192.168.0.70/
https://192.168.0.70:8172/
https://192.168.0.70:8172/MsDeployAgentService/
https://192.168.0.70/MsDeployAgentService/
I've tried the non-secure versions as well but just cannot get it to work. What is the correct format for the url? and what permissions am I missing?
the errors from VS have varied depending on how I attempt it but below is a sample:
Could not complete the request to remote agent URL 'http://192.168.0.70:8172//MSDEPLOYAGENTSERVICE'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Publish failed to deploy.
there really should be a guide out there to do this (yes, I've googled myself blue in the face)!
thanks - ekkis
ok, I've figured out that the correct url is:
https://192.168.0.70:8172/MsDeploy.axd
and that having the "Windows Authentication" enabled doesn't seem to make a difference. Also, having my account in the "Managers" list doesn't seem to make a difference either.
so the back end was all working fine (I've turned off the Web Deployment Agent Service). it was just the url I had wrong.

Resources