Error when deploy ASP.net MVC on azure ! Access is denied

-1

When i deploy a web MVC ASP on azure. it reported 1 error:

 [Win32Exception (0x80004005): Access is denied]
> 
> [SqlException (0x80131904): A network-related or instance-specific
> error occurred while establishing a connection to SQL Server. The
> server was not found or was not accessible. Verify that the instance
> name is correct and that SQL Server is configured to allow remote
> connections.

Previously I ran on the local host and it was running but when deployed on azure it reported this error. I have found the above ways and neither in detail nor ineffective!

c#
azure
asp.net-mvc-4
asked on Stack Overflow Oct 23, 2017 by SeeWICDo • edited Apr 3, 2018 by Cœur

1 Answer

1

According to your error message and application environment information, I guess you use local sql server database as your application database.

If you published the application to azure, azure web app couldn't access the local sql database. So you will face this error.

There are two solutions:

1.Using azure sql database instead of the local database.(Replace the azure sql database connection string with local sql database connection string)

About how to use azure sql database, you could refer to this article.

2.Using Hybrid Connections in azure web app to connect local sql database.

More details, you could refer to this article.

answered on Stack Overflow Oct 23, 2017 by Brando Zhang

User contributions licensed under CC BY-SA 3.0