Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
hello ,

am hosting web application on iis 7.5 and it work fine , but i cant access the database from sql , am using this connection string in my web.config

, what should i do else ? , the web application require login which is in database and i cant access to it , please help

XML
<remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=Ahmad-PC\SQLExpress;Initial Catalog=abad;Integrated Security=True" 

providerName="System.Data.SqlClient" />
    <add name="ABADConnectionString" connectionString="Data Source=Ahmad-PC\SQLExpress;Initial Catalog=abad;Integrated Security=True" 

providerName="System.Data.SqlClient" />
    <add name="ABADConnectionString1" connectionString="Data Source=Ahmad-PC\SQLExpress;Initial Catalog=abad;Integrated Security=True" 

providerName="System.Data.SqlClient" />



am using windows 7 home premium 64 bit , Microsoft SQL Server 2012 and IIS 7.5
Posted
Updated 28-Oct-15 8:14am
v2

Wait a second.
1) IIS does not connect to any RDBMS, except for storing session state - it is only a setting you can use in your application
2) SQL Express does not enable TCP/IP connector by default, you need to enable it[^].
3) For this to work, you need to have specific port level access[^] between the server running IIS and SQL Server - if they do not run on the same machine
4) In IIS applications run under application pools, that impersonate either a dedicated pool user or the authenticated client user (if NTLM or Kerberos is used). Kerberos is needed for delegation - if IIS needs to pass the client token to third party machine (running SQL server for example) delegation, thus Kerberos is needed. Integrated security authentication means delegation if the application is running under client user identity.
5) Either dedicated pool identity or client identity - integrated security implies that this user has to have access to SQL Server and the database of course.

So... check these...
 
Share this answer
 
v2
Comments
Member 11558177 30-Oct-15 10:55am    
what i mean is that when i run my application from Visual Studio it works perfectly with the database , and btw the database on same machine ,

but when i try to deploy it to iis , it never work
Zoltán Zörgő 30-Oct-15 14:20pm    
Well, than do what I suggested: check them. Yo don't take one or more into consideration.
Is the IIS you are trying to deploy to also on your development PC? If not, you need to prepare the database engine on the target environment too - and change these settings accordingly.
From your comment you pretty much have your answer.

If SQL server is running on you local development box, then chances are good that your server will not have access to it. What you need to look into is either using a separate SQL server that you host can access or look at installing SQL Express on the host where IIS is installed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900