0

I have an application which connects to our SQL Server 2008 enterprise.

My config file contains:

name="patbase" connectionString="Data Source=pbsqlserver1;Initial Catalog=patentbase;Trusted_Connection=True;;Application Name=PatBase Images;" providerName="System.Data.SqlClient"

When I test it from my PC it works.

When I publish it to the (internal) server I can see my user has logged into asp.net but data base access gives me:

An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.

6
  • Make sure the internal server has access to pbsqlserver1, from your internal server, ensure that you can ping pbsqlserver1. If it can't try putting the IP address, it may be a DNS issues. If there's no pinging DNS or IP from that server you publish on, it's a network connection error. Commented Apr 3, 2013 at 13:35
  • the ip address is working and another (asp.net) application connects to database. i can ping the server using name or ip address Commented Apr 3, 2013 at 13:43
  • so it works with an IP Address now? You could also try the fully qualified domain name or FQDN. pbsqlserver1.yourdomainname.com, if you don't want to use IP. Commented Apr 3, 2013 at 13:45
  • i can ping the IP , but the application dosn't work with ip address. also tried with my domain details no luck :-( Commented Apr 3, 2013 at 13:48
  • ef model or code first ? Commented Apr 3, 2013 at 13:50

2 Answers 2

1

Your connection string is using a "trusted connection" which means the identity of the client process/thread is used in the SQL login attempt. You say that your user has logged in to the ASP.NET app, but what is the identity of the application pool your app runs in?

You don't say what kind of authentication your app uses, but I'm going to assume Windows Authentication. If you want the end-user's account to be used for the SQL login, you will need to enable ASP.NET impersonation for your app. You can do this under "Authentication" in the IIS Manager, or in your web.config with <identity impersonate="true" />

If you don't care which identity is used for the SQL login attempt, you can create a SQL login for your application pool's identity.

Sign up to request clarification or add additional context in comments.

5 Comments

the IIS is setup for windows authentication , when i use impersonate i get "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"
Maybe you enabled Windows AuthN but left Anonymous AuthN enabled too?
Maybe the answer in this question points to your problem...? stackoverflow.com/questions/8718867/…
And naturally your web server and SQL server must both be in (or trust) the domain that authenticates your user.
it is , the funny part is that an asp.net application (which has a class connecting to the same database server with the same connection string), thanks for the help, hopefully some one else had the same issue, the server is a "windows storage server 2003 " ( i know, rolling my eyes)
0

try to see if SSPI security works

<connectionStrings>
<add name="patbase" connectionString="Data Source=pbsqlserver1;Initial Catalog=patentbase;Integrated Security=SSPI;;Application Name=PatBase Images" providerName="System.Data.SqlClient"/>
</connectionStrings>

or remove the ;;Application Name=PatBase Images at the end if that doesn't work.

1 Comment

no i tried that. for some reason it is passing in the iis anonymous user, even though IIS is setup for Windows Authentication

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.