views:

237

answers:

1

Hi All,

At the moment, when I try to register a user using the default Business Template in Silverlight, I am getting an error. Basically I am following a tutorial found on Channel 9 on how to build a business app with Silverlight.

"An error has occurred while establishing a connection to the server.

(provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326)".

I found a blog where it identifies the problem, and followed every step, however I am still getting the same problems.

Here is my connection string:-

<add name="SIEventManagerEntities" 
     connectionString="metadata=res://*/EventManagerDBModel.csdl|res://*/EventManagerDBModel.ssdl|res://*/EventManagerDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MONFU-PC;Initial Catalog=SIEventManager;Integrated Security=SSPI;MultipleActiveResultSets=True&quot;" 
     providerName="System.Data.EntityClient" />

Any help would really be very much appreciated!

Thanks

+2  A: 

Change the Integrated Security to a User that has access to the database and you should then get connected.

Example:

<connectionStrings>
    <add name="Doner.CMS" connectionString="Data Source=SQL2k8;Network Library=DBMSSOCN;Initial Catalog=Doner;User ID=myUser;Password=myPassword;"/>
</connectionStrings>
Ardman
Hi Ardman, you mean in the connection string? Can you give me a small example?
Johann
@Johann: as you can see I've removed the Integrated Security from the ConnectionString.
Ardman
@Johann: another thing has occurred to me, and that is the Machine Name. Is this the server you are connecting too? Or your local machine? If local, you'll need to obviously change this as well.
Ardman
Hi ArdmanI tried the following <add name="SIEventManagerEntities" connectionString="metadata=res://*/EventManagerDBModel.csdl|res://*/EventManagerDBModel.ssdl|res://*/EventManagerDBModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MONFU-PC;Initial Catalog=SIEventManager;User Id=johann;Password=mypassword;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />But now its telling me that login failed for user 'johann'
Johann
Does the user Johann exist in the database? And also make sure that the user has the necessary privileges for the database.
Ardman
Yes the user johann exists, and I also mapped the user to the SIEventManager db, through Properties --> User Mapping, and set all database roles to the user (just as a test for the moment) and still nothing is displayed in the website
Johann
Are you still getting "login failed" message?
Ardman
This is the whole error message:-System.ServiceModel.DomainService.Client.DomainOPerationException:LoadOperation failed for Query 'GetEvents'. The underlying provider failed on Open. Inner Exception message: Login failed for user 'johann'
Johann
Ok. Try and log-in to SQL Server using the user id johann and see if it connects. If not, reset the password for it and try it again.
Ardman
Ok i cannot log in with username Johann, even when changing the password
Johann
Have you created the user for the SQL Server? Or just the Database? If you click Security->Logins, do you see the Login? If not, create it there.
Ardman
yes its there, and set to master database now
Johann
Change that to point to your database.
Ardman
ok done, still cannot log in though with that username
Johann
Try deleting the user from the Security->Logins and also remove it from the database Security->Logins if it doesn't do that for you. Recreate the user in the Server Security->Logins and then try and connect to the Database Server using the newly created login.
Ardman
ok deleted the user, and recreated it, gave it an sql server login, tried to login in and failed again
Johann
Does your SQL Server allow Mixed Mode Authentication?
Ardman
Do you mean in security settings? Server Authentication? It was set to Windows Authentication Mode and changed it to both now. Tried to login again but failed
Johann
Now that you have done that, just try and create a new SQL user and try connecting again.
Ardman
Ok I created a new user Events, and when trying to log in, i get the same error, Login failed for user 'events'.Error 18456
Johann