Reputation: 1096
My connection string is working when I am connecting via IP adresss
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=ALIAS_SERVERNAME;Initial Catalog=DATABASE_NAME;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="DefaultContainer" connectionString="metadata=res://*/Models.Db.ModelName.csdl|res://*/Models.Db.ModelName.ssdl|res://*/Models.Db.ModelDb.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.0.61;initial catalog=DATABASE_NAME;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
I have created Alias on remote server, like I did it localy (same ports and names) ,but it doesnt working. And when I put IP addres in connection string, like the one I have posted it is working. Can someone pleas give me some instructions on how to troubleshot problem.
Error I am getting when I try to connect via Alias, and via IP it is working. Btw can connect localy via Alias.
(EntityException): The underlying provider failed on Open.
Upvotes: 1
Views: 1148
Reputation: 315
So, your DB server is aware of its alias name, but your application server is not. You have to create alias on application server. You can do that with
cliconfg.exe
(Start > Run > cliconfg > Click "OK") And than set your protocol, and port same as on DB server
Upvotes: 2
Reputation: 12050
You might need to add SQL Server name i.e. SQLEXPRESS, etc. at the end of your alias as shown below:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=ALIAS_SERVERNAME\SQLEXPRESS;
Initial Catalog=DATABASE_NAME;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
If you do not use default name for MSSQL Server then you need to change with what you used as name of it. You can check it on the Server Name field of the Connect dialog of SQL Server Management Studio as shown below.
Update: Here is the DataLink properties dialog shown below:
If it does not solved the problem, have a look at The underlying provider failed on open. Hope this helps...
Upvotes: 0