I have an mvc application thats built using the repository pattern. My Database resides in the SmokersTavern.Data folder. I have published the site to azure. On startup the user must logon thereof will be redirected to the Products table. However I get the following error.
It is not allowed to connect to local database when your web app has been published to Azure.
You should create an Azure sql database and connect to it instead. Here's the tutorial for you to refer.
You need to create an Azure resource group deployment project with your Visual Studio web application so that Visual Studio knows where to publish your code. Please take a look at this:
Creating and deploying Azure resource groups through Visual Studio
Although, you are using the 'Publish to Azure' feature, I don't see the resource group configuration in the Solution Explorer pane on the right (based upon the screen capture you provided).
Following this document will walk you through the set-up, configuration, and publishing of your web application to Azure.
I created the app service + sql and in my visual studio I connected to app service created on Azure. My connection string in my config file was not that of the Azure sql db
Related
I have a strange issue, when I deploy asp.net mvc app to azure service this error appears:
I have tried to clean my project, create new resource group, new app service plan and nothing helps. In fact, I don't know why this problem appears , I am doing the same actions as I was doing before, when successfully published my apps.
I am deploying my application from visual studio, I was trying to create web app from azure portal but I don't know how to connect my db to this app (I am using entity framework + code first and simple link to my db (in "link resources" tab of my web application settings) doesn't work.
Does some1 faced this problem before? I will be glad for any help.
P.S. Start page of web app works, but I can't connect to db.
Did you use the portal from manage.windowsazure.com or the new one which is portal.azure.com? I would suggest you to create everything (including app service plan, resource group, web app, etc) using the new azure portal because I found some reference that stated those two portal use different API so that's maybe why there are some problem if you use both portal at the same time (I don't know why they use different API). Maybe you can try to recreate everything but using the new portal consistently and let me know the result :)
Based on the error message, the root cause of your deployment issue is due to invalid Api version parameter for the resource group: "Default-SQL-NorthEurope".
The api-version you have specified for the above resource group deployment template is 2.0, which is invalid.
The valid api-version format must be: yyyy-MM-dd
The supported suffixes: "-preview,-alpha,-beta,-rc,-privatepreview"
From the name of your resource group, it should contain Azure Sql database server and database resources.
You should use api-version: 2014-04-01-preview for the resource group above.
Below is the reference for the resource group deployment template for Azure web app and SQL database:
Azure Quickstart template: 201-web-app-sql-database
Hope this helps!
I have been trying to get Umbraco working in a web role environment (web services) in Azure, but the site errors when you try and access it, saying that config/trees.config is not accessible.
These are the steps i carried out:
Create a new empty MVC4 project in Visual Studio 2013
Install Umbraco v7.1.8 from nuget
Run up and configure using a new azure SQL database.
Added in the umbraco folders to the solution.
Added an azure web services project to the solution.
Added the existing MVC umbraco project to the azure role profiles.
Published to Azure staging area.
The site starts up with the usual 'Looks like there is still work to do' screen in the full Azure emulator in visual studio with multiple role instances. However fails to run up when hosted in Azure.
I am currently assuming that the issue is that the site root does not have write access when hosted in Azure, so the IIS worker process cannot write to the trees.config file.
I found an article where you can add a 'startup.bat' file, with the following:
echo "starting startup task" >> log.txt
%windir%\system32\Icacls.exe .. \* /T /grant "Network Service":(F) > log.txt
But this stops the role instances for starting up at all in both the emulator and when hosting in azure.
Any suggestions would be gratefully appreciated
I would suggest using a VM instead of a web role for hosting Umbraco in Azure, particularly since Umbraco is needing local write access to persist.
Web roles expect your application to be stateless, meaning no writing or persisting anything to the actual file system. This guarantee allows Azure to make certain assumptions so that it can load balance and scale the application correctly (it basically saves a master copy and then re-deploys it fresh as it scales up or makes updates, etc. This works great for web apps that were created with this in mind, but if not, then a VMs allows you to scale UP without worrying about your app needing to work a certain way to properly scale OUT under a load balancer (which is what web roles are made to help you do).
So, basically I would suggest installing to a Virtual Machine. It's still in the cloud, and you get all the cloud benefits of on-demand scaling of the infrastructure. In addition, I would expect Virtual Machines to be a supported install of Umbraco, where a web role install would not. Hope that helps!
I am developing a website in Mvc4 using visual studio 2012 and now I am facing a problem regarding web deployment or I can say that I'm not getting solution for this problem.
My problem is that I want to publish my website from my website view I want to give a button in home page of my website as I click on that button my database updates in IIS or azure server. How can I do this any idea about it ??
I am Currently Using Azure Storage and IIS server for local testing.
if you want to do deploy for "Azure WebSite" and not "Azure WebRole" you may use FTP transfer.
if you want to do deploy for WebRole, the first thing you have to open Remote Desktop on it and probably PowerShell will help you to deploy. You may find more details on that subject in Azure Enable Web Deploy via automated deployment and Powershell - Create Azure Deployment Package
Also please keep in mind that your infrastructure must be in separate environment. If you try to control publish/deploy from a same site (say you are on Site X and you are deploying for Site X) if anything goes wrong, you will lose all the control.
I am very new to Windows Azure - have been into asp.net for about 10 years now and have been deploying applications via Database backup and restore on production and copy of final code bits from source control to the root folder on production database.
I am doing my initial reading and finding it a bit difficult to absorb the overall process of deploying an ASP.Net MVC web Application to Azure.
I have managed to have the database and the website code on Azure and it is up and running, but I can't get to terms on the following points and want to understand them better to have a regular deployment on place as versions of my app keep going up.
Database doesn't work like backup a local database and then upload .bak file and restore to the production server.
Nor can I see my website files.
Update: 04-Aug-2013
Azure Websites have an FTP option. You can see your FTP host name in respective website Dashboard. The username and password for FTP are located in the publish settings file (note: you got to pick up the FTP username and password, NOT the publish username/password. They both are different.
When I am getting ready for version 2.0 of my product, how do I get the database from the Azure SQL, upgrade it to 2.0 and put it back?
I assume the publishing wizard from Visual Studio should be able to take care of code upgrade, but how do I edit my production web.config file on the fly?
How do I take my website offline and show users my custom "offline" page when I am in the middle of the upgrade? (Stopping the website shows up the Windows Azure site not available page).
For your database backup / upgrade questions
For migration of databases to SQL Azure (or pulling them down) the SQL Database Migration Wizard has proven to be a lifesaver for me, get it here:
http://sqlazuremw.codeplex.com/
This will pull and push both data and schema for your database.
For seeing your website files
You won't be able to if you are using Windows Azure Websites.
For editing web.config on fly
You can't. BUT -- you can edit connection strings and appsettings through the 'configure' tab of your website like so:
Turning your website offline during upgrade
While you cannot specifically use the app_offline route without another deployment. One thing you could do is change your default document. This is easily done right in the same 'configure' tab for the website in the portal as I mentioned above, see here:
Hope this helps.
My Mvc website never opens up locally. It tries to search the website, but is unable to and in the end a 404 is displayed.
Please help on this, if you can.
I have one webrole (Mvc website) and two worker roles (WCF services) communicating with worker roles.
It works fine on Azure servers though...
It sometimes throws an error while running that Role Instances are taking longer than expected and I have to restart my system to make it running again (i.e., to reach up to the 404 error again)...
Thanks in advance...
Perhaps your local SQL Server instance is not running or misconfigured. It uses SQL Server to support table storage and other local resources. Check out DSInit to configure your database. http://msdn.microsoft.com/en-us/library/gg433134.aspx
Also, did you launch Visual Studio as an Administrator? You'll need to right click on Visual Studio and select "Run as administrator" in the context menu. I had the same experience a while back and I had forgot to do that step. This is required to run an Azure solution locally.