在 azure 上部署 ASP.net MVC 时出错!访问被拒绝
Error when deploy ASP.net MVC on azure ! Access is denied
当我在 Azure 上部署 Web MVC ASP 时。它报告了 1 个错误:
[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.
之前我在本地主机上 运行 是 运行 但是当部署在 azure 上时它报告了这个错误。以上方法我都找到了,既不详细也不无效!
根据你的报错信息和应用环境信息,我猜你使用本地sql服务器数据库作为你的应用数据库。
如果您将应用程序发布到 azure,azure web 应用程序无法访问本地 sql 数据库。所以你会遇到这个错误。
有两种解决方案:
1.Using azure sql database instead of the local database.(将azure sql database connection string替换为local sql database connection string)
关于如何使用azuresql数据库,可以参考这个article。
2.Using Azure Web 应用程序中的混合连接以连接本地 sql 数据库。
更多细节,你可以参考这个article。
当我在 Azure 上部署 Web MVC ASP 时。它报告了 1 个错误:
[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.
之前我在本地主机上 运行 是 运行 但是当部署在 azure 上时它报告了这个错误。以上方法我都找到了,既不详细也不无效!
根据你的报错信息和应用环境信息,我猜你使用本地sql服务器数据库作为你的应用数据库。
如果您将应用程序发布到 azure,azure web 应用程序无法访问本地 sql 数据库。所以你会遇到这个错误。
有两种解决方案:
1.Using azure sql database instead of the local database.(将azure sql database connection string替换为local sql database connection string)
关于如何使用azuresql数据库,可以参考这个article。
2.Using Azure Web 应用程序中的混合连接以连接本地 sql 数据库。
更多细节,你可以参考这个article。