我正在从 Azure 云服务连接到 SQL Azure 数据库。四分之三的工作角色可以毫无问题地与数据库连接和交互。第四个,由于未知原因,在我第一次与 DbSet 交互时抛出此异常:
System.Data.ProviderIncompatibleException: An error occurred while getting
provider information from the database. This can be caused by Entity Framework
using an incorrect connection string. Check the inner exceptions for details and
ensure that the connection string is correct.
---> System.Data.ProviderIncompatibleException: The provider did not return a
ProviderManifestToken string.
---> System.Data.SqlClient.SqlException: 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: Named Pipes
Provider, error: 40 - Could not open a connection to SQL Server)
---> System.ComponentModel.Win32Exception: The system cannot find the file
specified
所有四个角色都使用相同的连接字符串(来自服务配置),使用来自同一程序集的 Entity Framework 5 DbContext。
这是连接字符串:
Server=tcp:aaa.database.windows.net,1433;Database=AppName;User ID=appusername@aaa;Password=999;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
在开发结构上运行时我没有收到错误。我已尝试重新映像部署。SSMS 连接得很好。
这第四个工人还有什么不同会导致这样的错误?