How to host site with ASPNETDB.MDF database from Development Server to Production Server?

梦想与她 提交于 2019-12-13 05:49:14

问题


I have created my site using ASP.NET Personal Starter Kits 3.5. I use Visual Studio 2008 only . .with its built-in SQL Server (2005 Express) ... my database in App_Data is ASPNETDB.MDF ...

I have created some of my tables also ....in ASPNETDB ..

In my local PC the site was running fine ...

But when I publish my site on production server it doesn't work and shows the following error

<!-- Web.Config Configuration File -->
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->
<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration> 

My hosting provider connection string ..

<add name="ConnectionString" connectionString="Data Source=69.16.253.19;Initial Catalog=usa_data;Persist Security Info=True;User Id=user;Password=pass" providerName="System.Data.SqlClient"/>

My hosting provider gave me the connection string to connect to the SQL Server 2005 but it doesn't work...

I don't understand why my site was running fine using the production SQL Server 2005 in my local PC when I include ASPNETDB.MDF file in App_Data in my local pc only ..if I remove file ASPNETDB.MDF from App_Data of my local pc ... the site stops working ...

Can anybody tell em how to fix this ... !! I am very tensed since last 3-4 days


回答1:


Firstly, the file in the APP_DATA folder is not accessible as a DB in production. You will have to migrate the whole Database from the ASPNETDB.MDF to the Production Database server (given by provider.) And then the site will work. Also, change the config to : to see the exact error!!

If the porting doesn't work, see the exact error and post it here.




回答2:


make a backup of your ASPNETDB.MDF file an import it into your hosting after put this on your config file:



来源:https://stackoverflow.com/questions/4763019/how-to-host-site-with-aspnetdb-mdf-database-from-development-server-to-productio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!