Click here to Skip to main content
15,921,697 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I have a asp.net mvc5 application.

But sometimes I get this error(see below). But the strange thing is that, after I clear cache in the browser the error dissapear.

Quote:

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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102[^]. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Thank you
Posted
Updated 15-Mar-18 23:08pm
v2
Comments
ZurdoDev 29-Apr-15 15:52pm    
The browser has nothing to do with that error since that is code running on the server and not on the client's machine. You should show the full error.
[no name] 29-Apr-15 16:30pm    
Hi, thank you for your comment, but this is the full error. Realy, the site is: lolacyclingclub.org. Sometimes this error appeared. And if I clear the cache, the error is gone. But the thing is it happens local and on the server. And espacially on the server is not nice ofcourse

1 solution

TITLE: Connect to Server
------------------------------

Cannot connect to admin-PC or server.

------------------------------
ADDITIONAL INFORMATION:

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) (Microsoft SQL Server, Error: 2)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
SOLUTION :-

1.click on Start button.

2.Search on Search Bar.

3.Type Services.And Click on that

4.And go to Sql Server(MSSQLSERVER).

5.Right click on it.and Click on Start button.

6.And go back to sql Server Close it and connect it again.
 
Share this answer
 
Comments
Richard Deeming 16-Mar-18 13:08pm    
Three years too late, and you've only listed one of dozens of possible causes of this error. You might as well have posted, "Make sure your computer is turned on"!

Stick to answering recent questions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900