Reputation: 1163
I have a MVC Project Which I want to Publish and upload it
I asked the server provider to upload my data base. My Data base is local
and here is the information of this:
Name : vidiaweb_com_TourDbContext
DataBase: vidiaweb_com_TourDbContext-20160613111028
and here is my connection string
<connectionStrings>
<add name="vidiaweb_com_TourDbContext" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\vidiaweb_com_TourDbContext-20160613111028.mdf;Initial Catalog=vidiaweb_com_TourDbContext-20160613111028;Integrated Security=True;User Id=vidiaweb_com_TourDbContext;Password=password;" providerName="System.Data.SqlClient" />
</connectionStrings>
but in each page Which there is model for example like this
@model IEnumerable<vidiaweb_com.Models.Country>
, an error appeared:
'Server Error in '/' Application.
The system cannot find the file 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.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
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.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified] '
Dose any one have any idea what may would be the problem?
Upvotes: 0
Views: 39
Reputation: 56909
Obviously, your web host is not putting the database in the /App_Data/
directory of your web site, which is what you are specifying in the connection string with |DataDirectory|\
. It is likely being attached to a real SQL Server instance, in which case you won't specify a directory.
You need to obtain the server details of the database from your web host. Most likely your connection string will look something like this:
SERVER=data.somewhere.com;DATABASE=vidiaweb_com_TourDbContext;UID=TheApplicationUserName;PWD=TheApplicationPassword;
See ConnectionStrings.com for some more samples of what the connection string could look like.
Upvotes: 2