• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Web app access to the MS SQL Database works when debugging localhost but doesn't work once deployed to local IIS7 web server

I've created a web application in ASP.NET with VB.NET as the code-behind using Visual Studio 2010. The web application is connected to a MS SQL Server 2005 database on a remote web server on the company's intranet. When I run the application as localhost through Visual Studio 2010 everything works fine, I'm able to login to the website, and access data within the database from the website, as well as insert data in to the database via the web form.

The problem is once I deploy this web application to my local web server set up with IIS 7, and try to browse the site, the site comes up, but anything on the site related to accessing the MS SQL database (ex. inserting data through form, loginng in to access protected pages) is not functional. And the browser does not return any kind of error whatsoever.

Please help,
Thanks.
0
rmitwiz
Asked:
rmitwiz
  • 2
1 Solution
 
MlandaTCommented:
What are your security settings in the connectionstring to the database? Are you using SQL authentication or Windows authentication? http://www.connectionstrings.com/sql-server-2008

Are there database management tools e.g. SQL Server Management Studio on the web server - are you able to connect to the database from this server using SSMS?

Errors not showing on the interface might be due to how you are handling your exceptions. What are you doing with the exceptions in your Try...Catch blocks?
0
 
rmitwizAuthor Commented:
My connection string is as follows:
<add name="ConnectionStringpforms" connectionString="Data Source=servername; Initial Catalog=DatabaseName; Integrated Security=True" providerName="System.Data.SqlClient" />

Yes, I am able to connect to the database from the server using SSMS.

And I do not have any Try...Catch Blocks in my code.
And keep in mind everything works perfectly  on localhost. Just not once the web application is deployed to my local machine's IIS7 web server.
0
 
MlandaTCommented:
"Integrated Security=True" means you are running the application with windows authentication. Now, when you run on your machine, you are using a different account to the one being used by the web server to log onto the database. The web server will use the account under which IIS or more specifically, the account under which the application pool is running.

"Yes, I am able to connect to the database from the server using SSMS." that tells us that a connection to teh sql server is possible from the web server box. That eliminates network and firewall configurations etc etc.

To cut a long story short, I would recommend SQL Server authentication. Either use the "sa" account, or preferably, create a SQL account for your application with access to the database in question and setup your connection string to use that account.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now