Last post Jun 10, 2019 01:54 AM by Wei Zhang
Jun 07, 2019 03:13 AM|hkbeer|LINK
I am using VS 2019 and created a ASP.net site with mdf file inside App_Data which seems to store user's login info.
After publishing to Azure etc I found the mdf is not uploaded there in the published App_Data folder and now it is causing trouble.
Any one get experience what is the logical next step here ? Thanks
Jun 07, 2019 06:29 AM|AddWeb Solution|LINK
According to your description ,
I understood that you are developing an ASP.NET website, which you want to host on Azure Websites. While in development you have been using an MDF file in my App_Data directory with a connection string
After publishing to Azure etc you found the mdf is not uploaded there in the published App_Data folder . For it may be some reasons are there
1) If you're using an azure database, there is no reason to keep the .mdf in the App_data folder . Maybe you have created a mdf file inside the App_Data folder. The file is deleted from file explorer, but the file record haven't been removed
from the project file. To check it, you could open your project file using notepad.
After opened the project file. You could search 'App_Data' to check whether there are content records like following. If yes, you just need to remove these records and save the project file.
<Content Include="App_Data\Database1.mdf" />
2 ) You can't use an .mdf file in App_Data, but you aren't forced to SQL Azure -- you can use SQL Server Compact. Deployment from LocalDB to Compact is easy if you are using Code First Migrations; otherwise you will have to migrate to SQL Server Compact
before you deploy. If you decide to go with Compact you'll have to make sure the database engine gets deployed, and you can find instructions for that in this tutorial
I hope this will help you to solve your query
Jun 07, 2019 07:10 AM|DA924|LINK
The standalone MS SQL Server Express detached MDF file from the MS SQL Server Database engine is a single user instance database file that can only be opened and used by a single user, which is not a concurrent usage database. It means that multiple users
trying to use your program will be terminated and an exception thrown when one user has the MDF file opened and in usage by a single user. The detached standalone MDF file must be attached to a MS SQL Server database engine in order for the MDF file to be
used in a multiple user environment such as a ASP.NET program would be used on a Web server.
Jun 10, 2019 01:54 AM|Wei Zhang|LINK
According to your description, when you host a webapplication on Azure, it will compress the file in App_Data into a dll file , so you couldn't see the mdf file in it. So I suggest that you could try to put it outside the App_Data to a new folder or you
could just use SQL Server Compact.