0 votes
1 view
in Azure by (38.4k points)

I'm creating a MVC 5 web application with EF 6 Code first. Now it creates a database in the App_Data folder. I want to publish the website to an Azure website. Because this is only the test version of the website, I don't want to pay for it. It will only visited a couple of times a month until it is in production.

Is it possible to run the database something like an access database file? I thought that some kind of functionality existed. I thought the name was SQL Server Compact Edition? But how does it works?

I also thought that you could create a free 20MB sql server database. See this link of the pricing page. Search for 20 in your browser. http://azure.microsoft.com/en-us/pricing/details/web-sites/ I don't see that option.

Any ideas would be welcome!

1 Answer

0 votes
by (16.8k points)

Solution for free SQL Server in Azure:

Install two nuget: EntityFrame.SqlServerCompact & Microsoft SQL Server Compact Edition

Put your SQL database file (.sdf/.mdf) in APP_Data folder

Now put the connection string just like below, to use it:

<add name ="DefaultConnection" connectionString ="Data Source=|DataDirectory|CompactDB.sdf" providerName ="System.Data.SqlServerCe.4.0" />

Now, publish your whole project and include the above SQL database file to AzureWebsites.

This shall start working and it's totally free.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...