我有一个 azure 数据库,它连接到我的 C# 应用程序,我使用 App.config 创建连接字符串。当我运行我的程序时,它变得非常慢,但是当我连接到本地 SQL 服务器时,它非常快。如何在我的应用程序上快速建立 azure 连接?
我的应用程序配置
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<clear />
<add name="fudz" connectionString="Data Source=[my server];Initial Catalog=[databasename];Persist Security Info=True;User ID=[my user name];Password=[my password];Encrypt=true;TrustServerCertificate=False;Connection Timeout=30;"/>
</connectionStrings>
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>
最佳答案
这可能是您的计算机和 Azure 数据库之间的网络延迟。您可以使用某些网络工具,例如 ping
、tracert
等来查看网络延迟。然后,您可以考虑提高网络连接速度(通常通过您的 ISP)。
您还可以选择距离您运行应用程序的位置最近的 Azure 托管
Azure 位置 - https://azure.microsoft.com/en-us/regions/?cdn=disable
关于c# - 我的 C# Windows 窗体应用程序和 azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44718589/