ASP.NET: Can't connect to SQL Server database after uploading to server - asp.net

I'm trying to upload my asp.net site to my HostGator windows server. I'm having a problem connecting to the SQL Server database in my App_Data folder. It's giving me the error:
Login failed for user 'PSS004\IWPD_353([UserName])'.
I use Windows Authentication in Visual Studio 2010 to access the database and view the site just fine locally. Is that causing a problem? If so how do I set up a user/pass to use when accessing the database file once it's on my hosting server?
If any further information is needed that I left out just let me know.
Thanks!

When you run the code from your webserver, its most likely using a network service account (and hence windows auth wont work). Add a user account to sql server and change the connection string to use sql auth instead and that should fix it

Related

Migrating a classic ASP's SQL Server database from a server 2003 to a 2008r2 server

I have a situation where a classic ASP's SQL Server database has been moved from a server 2003 to a 2008r2. The classic asp application stills resides on a server 2003.
Now because I have never done a migrating the only thing I thought I needed to change is the SQL Server named IP address in the application's IIS deployed ini file. Currently I am using anonymous authentication and the default application pool. The application render's to the browser fine. The problem is the application is not pulling any data for the database.
It seems that I have missed something in the configuration process. Has someone done this type of migration and if so provide me a list of thing that they have done to configure the application correct and other settings for the migration?
Thanks,
Steve Holdorf
This is not an asp but a database authentication.
It sounds like you used Windows authentication to connect from asp to the old server. Windows authentication means that asp uses IIS user identity to connect to the database and in your ini-file (or asp files) you do not provide any user/password to connect to sql.
If you want to keep this type of authentication for the new database, then you would need to configure user on the new Sql Server. Look at the old server, you should find the user named similar to domainName\WebServerMachineName$. You would need to create the same user on the new Sql Server and grant the same rights as on the old database. Read more https://msdn.microsoft.com/en-us/library/ff647396.aspx
If this is not an issue, then you should find what is the error message when application is not pulling any data for the database.

ASP.NET + Umbraco + SQL Server - No connection could be made because the target machine actively refused it

I'm trying to setup a local version of a website that's online and working. The site is built with Umbraco V6, and is using an SQL Server database. My test server is a fresh install of Server Standard 2012 and SQL Server 2012.
My process has been to:
Install the O/S and SQL Server
Setup a test Umbraco site in IIS, installing from scratch into a fresh database
Once 2. is working, download the source code from the live server and install in a new site in IIS
Download a copy of the live SQL Server database and restore it into the server
Add a new user account into SQL Server, granting permissions onto the SQL database i've restored
When I try to access the website through a browser, I get an error. This shows up in IIS as:
Event Code 3005. An unhandled exception has occurred. No connection could be made because the target machine actively refused it
I've disabled the Windows Firewall and have checked I can telnet into the server on port 1433. I know the Web.config is using the right credentials, as I can change it to a different user account and see a different error.
Can anyone point me in the right direction to resolve the error?
You should go through the steps listed over here:
http://blogs.msdn.com/b/sql_protocols/archive/2007/07/19/tcp-provider-no-connection-could-be-made-because-the-target-machine-actively-refused-it.aspx
I suspect that your connection string is pointing to the wrong server instance or that the TCP protocol is not configured correctly.
Tip: You can always copy and paste the settings from your connectionstring into the Connect Object Explorer of SQL Management Studio to verify that they work.

Simple ASP.net SQL Server database editor application

I have a website externally hosted, to which I have FTP access, however it is not a dedicated server so I can't directly connect to SQL Server. I have the database connection string from the web.config file.
I need to edit the database directly, but obviously tools like SQL Server Management Studio aren't going to work.
Is there a (free) simple database editing application available that will run directly alongside the website on the same server? I HAD one for classic asp years back but have always run dedicated servers since...
Actually you can access a database from a service like GoDaddy that is hosted with shared hosting through SQL Server. Check this link: http://support.godaddy.com/help/article/4978/connecting-remotely-to-shared-hosting-databases. GoDaddy says that you could even use the SQL Server Express edition to access your database directly and remotely but you must enable Direct Database Access when setting it up.

Error when trying to run query using Access remote table

I have an Access database with local and remote tables. The remote tables are linked to a Sql Server Database through an ODBC connection.
When I open the Access database, I can open and view the contents of both the local and remote tables. So this is proof that there should be no problem connecting to the remote tables from an ASP.NET app
Now when I run my ASP.NET app in Visual Studio, I am able to access both the local and remote tables in Access with no problem.
As soon as I put my app into IIS and run the app from localhost, I am only able to access the local tables in the Access file with my code but none of the remote tables! I get the following error when I try: "ODBC--connection to 'FMPOS_live' failed." But remember, I have no problem opening the remote tables from Access directly but I can't access them from my app running in IIS for some reason.
Is there a permission somewhere that depending on who or what is accessing the Access file, determines whether that process can use the remote tables??
When running from Visual Studio you are using your own credentials to connect to the SQL server.
When running from IIS you are using either ApplicationPoolIdentity, Network Service, or Local System depending on configuration of the application pool. You would need to allow login and read privileges to whichever account the website is running under.
In the case of running from VS it's probably working because you're probably a sysadmin on the SQL server.
Try checking what user is running "w3wp.exe" in the task manager.
In the case of ApplicationPoolIdentity the username you're looking for will be IIS APPPOOL\NameOfApplicationPool.
The problem was the application pool identity. Access wasn't allowing access to it's remote tables by the default process ApplicationPoolIdentity Identity. I changed the identity to my windows user login and it worked!
Instructions:
1. Go to the Application Pool for your website
2. Click on it and select Advanced Settings
3. Under Process Model Identity, choose Custom Account and type your username and password for your windows login.

Publishing ASP.NET site - No login database?

I have a very simple app on my local machine that uses the ASP.NET membership provider. This works fine on my local machine.
I have published the app to our web server, and I need to know the specifics of setting up the application for asp.net membership to work.
I have a basic understanding that it uses an MDF file and somehow connects to a SQL database (SQLEXPRESS I assume on my local machine) which holds the user/role information.
I keep getting an error that it cannot connect to a SQL database when running the published application on the web server.
I wish to use a SQL server on a different machine (SQL69) than my web server (WEB69)
I have created a new connection string, but how do I tell ASP.NET to use it instead of the "LocalSqlServer" connection string that is created by default?
Can someone explain what is required to me?
Thanks for any help you can offer.
Use the ASP.NET SQL Server Registration Tool without any parameters to set up the SQL Server membership on your local machine. This will also update your config file:
http://msdn.microsoft.com/en-us/library/ms229862%28VS.80%29.aspx
You need to set up SQL Server DB membership on your local machine first. After you have this working, you can simply script the entire DB for your production environment. For this, you can use the Database Publishing Wizard in VS.
You can view a sample config file here:
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx

Resources