Can't access .mdf on IIS, only on IIS local - asp.net

I am able to access a .mdf file on local IIS. However, when I move it to the server under app_data, I can't. Am I missing a step?
Additional Information
The .mdf is under app_data on the server.
It appears like it is trying to connect, but cannot.
Connection string is as follows:
Public Const SQL_PRO As String = "Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\MyDB.mdf;Integrated Security=True"
Update 2
Here is the Error Message. Sql Express 2008 is installed on IIS
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.)
Thanks,
Eric

In your VS Project, in solution explorer, choose the MDF and choose properties (Alt+Enter), for Copy to Output Directory, choose Copy Always. Im thinking your file isn't packaged when publishing.

Related

Establishing connection to SQL Server Error

I opened my web project today and for some reason I could not gain access to my database files. I get the following exception whenever I try to add, edit or refresh my database:
A network related instance specific error occurred while establishing
a connection to SQL Server. The Server was not found or is was not
accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections.
I took a look at my connection string for any spelling errors and deleted my database and replaced it in the folder I had it in. I can't seem to find a fix for this so any help would be a appreciated. I am using Visual studio 2008 for this web project.
This sounds like the same problem that I had myself awhile back. My problem was that my SQL service pack 1 did not install properly so I had to install Microsoft SQL Server System CLR Types, Microsoft SQL Server 2008 Management Objects and Microsoft SQL Server 2008 Native Client. After that I could create new SQLdatasources but I could not edit the ones I had previously before my problem. I had to restart my computer in safe mode and delete my SQLEXPRESS folder then recreate the database connection in visual studios. When I finished that everything worked fine.
This is the site I got those downloads, http://blogs.cametoofar.com/post/cannot-load-file-or-assembly-microsoftsqlservermanagementsdksfc.aspx

Connecting to Database in MS Visual Studio 2010 Error

When I try to make a connection to a database and error occurs. The message is
"A network related or instance specific error occurred while establishing a connection to the SQL Server."
The database is located in the App_Data folder of the project.
Does anyone know how to fix this? Thanks.
If Database in App_Data then most likely a SQL Server Express database. Open SQL Configuration Manager on your local machine and start the SQL Express Service.

SQL error 26=-error locatig server. ASP.NET

I am trying to deploy my .NET webservice on to provider (somee.com). I published the webservice and copied the folder over to the hosting site. I have my App_data folder copied too. I can access the service webpage. But when trying to access the website I received the following error. I have sqlserver express on my local machine.
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)
should i make i changes to my web.config file.
Please help
You have to modify your ASP app to use the database provided by somee for you (see http://somee.com/MSSqlDefault.aspx), not the one in app_data. You also need to upload your deployment scripts and configure the somee provided database before you can start running your ASP app.

ASP.NET: How to deploy App_Data to webhost?

I have uploaded my website to my webhost and it works great except the form authorication. When i try to login at get this error:
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 deploy the website i publish it from Visual Studio to a local folder and then upload it to the webhost via a FTP client program. The problem here is that the App_Data folder is empty when i publish the website to my local folder. Could this be the problem?
Check if your server allows to run user instances. If it allows then you need not do anything and just upload the MDF file to the App_Data folder on the server and you're good to go. You can also include App_data for publish which will automatically pick-up the App_Data folder along with the content.
If your server does not allow user instances then you need to perform following steps..
Ask admin to give you a SQLServer database along with access credentials.
From your Visual Studio right click on your database from the server explorer and select the option to PUBLISH TO PROVIDER. Follow the wizard steps and generate the SQL script with or without default data.
alt text http://ruchitsurati.net/myfiles/db.png
Connect to your Remote SQL Server from management studio and run the generated SQL script on the database given by your admin.
Update the connection string in your application for deployment.
Tick the "include files from the App_data folder" checkbox when publish.
alt text http://img260.imageshack.us/img260/8891/appdatapublish.png

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible

I am getting the above error when I upload my app to the hosting company.(asp.net)
DB is a local sql mdf in app_data directory.
on local asp.net dev server everything is ok.
I am using LINQ to SQL Classes, is there anything that can be related to that?
Thanks in advance
I think that the feature of attaching mdf files from the App_Data directory is a feature that is exclusive to SQL Server Express edition. Most likely your hosting company is using another edition of SQL server that does not support this.

Resources