简体   繁体   中英

Can`t publish a MVC project to Azure

I am deploying the first time a MVC5 project to Azure . I went for the codefirst approach with an existing database that I had on my SSMS . Then I migrated the database with the SQLAzureMW tool to a Azure database. It works great with the connectionString pointing to the Azure database when I am debugging locally from within VS2013 .

But when I am publishing my project from VS to Azure, and try to login or access anything that has database access, it brings the follwing error(The site works fine):

Error. An error occurred while processing your request. 

I tried various attempt but unfortunately without success. Any hint what this error might cause? Or a workaround to get the project online?

Update / Solution:

I copied the connectionString from the web.config that points to the Azure database into the fields of the settings section of the publish wizard of VS.

Check this comprehensive article about troubleshooting issues in Azure:

During development and testing of a web application, you can troubleshoot by running in debug mode or by using IntelliTrace. You can run in debug mode locally in IIS Express or remotely in a Windows Azure Web Site. But for errors that occur only in production, the best way to debug might be by reviewing logs that application code or the web server creates. This tutorial shows how to use Visual Studio tools that help debug an application while it runs in a Windows Azure Web Site, by running in debug mode remotely or by viewing application and web server logs.

http://www.windowsazure.com/en-us/documentation/articles/web-sites-dotnet-troubleshoot-visual-studio/

Also, make sure that your Azure SQL database has a port open in firewall to allow traffic from within Azure:

When an application from Windows Azure attempts to connect to your SQL Database server, the SQL Database firewall looks for a specific firewall setting that indicates whether Windows Azure connections are allowed. A firewall setting with starting and ending address equal to 0.0.0.0 indicates that Windows Azure connections are allowed. If the connection attempt is not allowed, the request does not reach the SQL Database server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM