C# 在本地运行web应用程序时连接到Azure数据库

C# 在本地运行web应用程序时连接到Azure数据库,c#,asp.net,azure,C#,Asp.net,Azure,我一直在开发一个基于Azure的基本web应用程序,但遇到了一个问题。应用程序查询托管在Azure上的数据库并将值返回给用户。当我在我的私有wifi网络上本地运行应用程序,并且当我将应用程序部署到Azure时,它运行良好,并且正确返回查询。但是,当我在公司的wifi上本地运行应用程序时,会出现以下错误: An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not

我一直在开发一个基于Azure的基本web应用程序,但遇到了一个问题。应用程序查询托管在Azure上的数据库并将值返回给用户。当我在我的私有wifi网络上本地运行应用程序,并且当我将应用程序部署到Azure时,它运行良好,并且正确返回查询。但是,当我在公司的wifi上本地运行应用程序时,会出现以下错误:

An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code

Additional information: 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. 
(provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

有人能告诉我是否需要添加任何其他代码,或者我需要在公司的防火墙中添加什么例外情况,以便允许我在本地运行和测试应用程序吗?

您是否为SQL Azure配置了防火墙规则?是的。当我单击设置此IP地址的Windows Azure防火墙规则时,它显示当前IP地址193.X.XXX.XXX已经有Windows Azure防火墙规则。您应该能够从此计算机连接到Windows Azure。“您的公司wifi”可能具有未配置的不同IP…此外,Azure数据库通过端口1433进行通信。大多数公司防火墙都不会打开。您能从您的工作机器通过SSMS连接到它吗?还是1433号的telnet?谢谢你。最后在公司防火墙中设置了一个例外,它工作正常。