Hi i want to publish my application in a IIS server.
First i create a database in my sql server and put all my needed data on it.
Then i update my web.config to use the new remote Database. Unfortunatly i get an error
ConnectionString:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IntranetDatabase;Data Source=SRVDEV2010\SRVDEV2010" />
Stacktrace :
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
I cheked if i can access database remotly. I create a udlfile to verify my connectionstring, Here is the result.
I don't know why the udl file can connect but not my application. Any help is appreciated
Under which user is the Application Pool configured to run? you're using Windows Authentication which means your IIS App pool should be configured to run under a user that has access to the DB.
Related
I put my MVC4 website on our DEV server running IIS7.5 (.NET4.0 ) and it works fine pointing to either server database or my own local db specified as [Machine Name][Sql Instance]. Application is on application pool running under service account. I made sure that user has that service account added to their SQL Logins and given dbo permission.
When I change in connection string to use other user's machine, and specify [machine name][sql instance] it throws an error.
Error says:
[SqlException (0x80131904): A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow
remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is
not valid)]
[EntityException: The underlying provider failed on Open.]
[HttpException (0x80004005): Error executing child request for handler
'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
This is connection string:
<add name="ProjectUI" connectionString="metadata=res://*/ViewModels.
ProjectUI.csdl|res://*/ViewModels. ProjectUI.ssdl|res://*/ViewModels.
ProjectUI.msl;provider=System.Data.SqlClient;provider connection string="data
source=MYMACHINEID\MSSQLSERVER;initial catalog=DBName;integrated
security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
Things I tried:
I verified remote connections are enabled on the SQL
Enabled TCP/IP port
Added exception to SQL server inbound rules in firewall
Added service account to local database with dbo permissions
The combination of settings that worked:
Enable TCP/IP (and Named Pipes)
Restart the SQL Server service
Ensure service account is added to the database and given appropriate permissions
No firewall settings needed to be changed (no rules were allowed than what was there before)
Connection string modified to: data source=UserMachineID without the server instance (since it was the default one MSSQLSERVER)
I have developed a web site that utilizes login in control using the ASP.NET Web Site Administration Tool. I then moved the entire project over to the server that will be hosting the project. I have the site on IIS 7 but when I try to login, I get the error message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)
I have given the proper permissions to NETWORKSERVICE. It seems from browsing around online that this is a sql server problem. It works fine in VWD Express but not on IIS. I know that the roles,users,permissions are stored in a .mdf but I'm guessing that it's not being accessed correctly.
Does anyone have any insight on this?
Here is my connection string:
add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-GMPL-20130618083445;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-GMPL-20130618083445.mdf"
providerName="System.Data.SqlClient"
Thank you in advance!
It's trying to use "LocalDB", which is probably not installed on your server. You probably should be connecting to a regular database, as opposed to LocalDB.
LocalDB is a new kind of SQL Express - seems to be made for development machines rather than for actual servers.
change Connection string to
"Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"
I have a web app that I developed using Visual Web Developer 2010. The database is local inside the solution:
<add name="SFDBConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SFDB.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
I'm trying to run the app on another machine using Visual Studio 2010 instead of the web developer and it's giving me the following error when it tries to connect to the database:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
Does anybody has any idea on what could be happening?
Usually, this error message means exactly what it says...
Can you connect to the SQL server through UI client (like, management studio)? If yes - how do you do that (user/password or Windows authentication; what is the server name)?
What is the connection string? You put here the connection string to SQL Express (which works; so it isn't quite helpful) - but forgot to put the connection string that doesn't work.
If you can connect in UI, and connection string is correct - there is no reason why the code would throw an error!
I have domain on the godaddy.com. I have create the database over there.I am able to connect to the database from godaddy.com site with specified user name and password. but when i am going to use same information in my connection string in my asp.net web application on local machine it is showing
"A network-related or instance-specific error occurred while establishing a connection
to SQL Server. The server was not found or was not accessible. Verify that the instance
name is correct and that SQL Server is configured to allow remote connections. (provider:
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
This error.
my connectionstring is :
<add name="MyConnectionString"
connectionString="Data Source=myDataSource; Initial Catalog=MyDatabaseName; User ID=MyUserId; Password=MyPassword" providerName="System.Data.SqlClient" />
I have provided all required parameters to connection string here.I got this parameter information from godaddy.com database Description section.
You can't do that, their SQL server don't accept external connections.
[EDIT] OK, it seems that my first sentence is incorrect, look here:
http://community.godaddy.com/help/article/4978
http://community.godaddy.com/groups/web-hosting/forum/topic/ms-sql-remote-access/
http://help.godaddy.com/article/4977
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
when i upload my site on webserver and connect with remote sqlserver2005 using connection string....
<connectionStrings>
<remove name="ConnectionString"/>
<add name="ConnectionString" connectionString="Data Source=69.16.253.19,1433;Initial Catalog=vb_usa;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>
it produces the following errr --
you can see error in my webpage :
http://vbi.volvobusesindia.com
it shows an error above ..
i m using aspnetdb.mdf in my website in APP_Data Folder... features i use in my website is Login Control, Password recovery, signup control...
Tried all the above but did not work for me. When I checked Services, I found that the SQLExpress service which was set Automatic, was not started. Once I started the SQLExpress service, everything worked.
See the guide in this site http://www.connectionstrings.com/sql-server-2005
In particular look at the section on that page titled "Attach a database file, located in the data directory, on connect to a local SQL Server Express instance"
The format is:
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;
Database=dbname;Trusted_Connection=Yes;
Basically, you need to connect to the SQL Express instance installed on the web server and point it to where your database file is located.
On that remote machine (63.15.223.19), the SQL services are not running. You can go to that machine and try to run "net start mssqlserver" from command prompt.