Cannot connect to SQL Server instance from web application but can from SSMS

0

I've got SQL Sever 2008 R2 Express installed and am able to connect to it with SSMS using (local) and Windows Authentication.

However, when attempt to connect to it from an MVC Web Application running in Visual Studio 2012, I'm getting a network related exception when I try to open a connection to it.

This is my connection string:

connectionString="Server=.\SQLEXPRESS;Database=DavisFamily;UserID=adminuser;Password=******;"

I know this is set up correctly in other environments because other people have the app working just fine. I need my machine to be able to take this connection string and work with it.


So I just opened up Sql Server Configuration Manager to try to determine what my instance name is and the first thing I noticed is that when I click on the "SQL Server Servies" node of the "SQL Server Configuration Manager" tree structure, I'm getting an error message in the right side pane saying "The remote procedure call failed. [0x800706be]

Could this have anything to do with why I cannot connect to it from a web application? Bare in mind that I can connect to it directly using SSMS "(local)".

database
sql-server-2008
sql-server-2008-r2
database-connection
asked on Stack Overflow May 9, 2013 by jdavis • edited May 9, 2013 by jdavis

3 Answers

1

Go to SQL Server Configuration manager (under sql server configuration tools)

Open SQL server network configuration

Open protocols for your instance Make sure TCP/IP is enabled

Open tcp/ip properties, under IP All > Set the port number is 1433

answered on Stack Overflow May 2, 2017 by Mosta
0

maybe this help you. if I have gotten your meaning right...then: By using this code below you can access your server and database information. try... may this be helpful.

using Microsoft.SqlServer.Management.Smo;

Server server = new Server(".\SQLEXPRESS");
string Name = server.Databases[0].Name;//Also the Name of your Database 
server.Databases["DavisFamily"].Rename("NewName");//Rename

This code is in C#.But note that I guess maybe you cant use this Rename function for the database used by your current Application or website

answered on Stack Overflow May 9, 2013 by Fuad
0

Ooh I see. For the first issue I think this help you: Now you are using adminuser for your login's username.you can set some properties fot it.

First log in your sql by using Sql Server Authentication username : sa and your password. then do this...

In your SQL Server Management Studio and left tree > Security > Logins > right click on adminuser and chose Properties > In the Server Roles check both public and sysadmin boxes > Then in User Mapping check the database DavisFamily that you are gonna use > then click Ok

try actions above...may these be helpful.

and for the second issue (error message "The remote procedure call failed. [0x800706be]). many reasons cause to this issue...have you another sqlserver installed with lower version on your Windows?If yes, look __ Sql Server Configuration Manager__ for that version. maybe this causes that issue...and also I read some where those who had this error , solved that by installing SQL Server 2008R2 service pack 1.
also you can check these links below :
[Link 1] : Remote Procedure call failed with sql server 2008 R2
[Link 2] : The remote procedure call failed

answered on Stack Overflow May 9, 2013 by Fuad • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0