EF天蓝色连接问题

时间:2015-05-29 11:37:14

标签: c# entity-framework azure

我有一个带连接字符串的Web应用程序:

Vector3 rotation = new Vector3();
rotation = this.transform.rotation.eulerAngles;
float ver = Input.mousePosition.y - mouse_position.y;
difference_y = difference_y ?? ver;
rotation.y += (float)(((Input.mousePosition.x - mouse_position.x) / one_degree_per_pixel_hor));
rotation.x += (float)((-(Input.mousePosition.y - mouse_position.y) / one_degree_per_pixel_ver));
rotation.z = 0;

if (difference_y != 0) {
    //  Forward tilt
    if (difference_y < 0) {
        if (rotation.x > max_slope_forward && rotation.x < max_slope_back) rotation.x = max_slope_forward;
    }
    //  Back tilt
    else {
        if (rotation.x < max_slope_back && rotation.x > max_slope_forward && rotation.x != max_slope_forward) rotation.x = max_slope_back;
    }
}

difference_y = ver;
this.transform.Rotate(new Vector3(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0),Time.deltaTime*SpeedRotation);
rotation = this.transform.rotation.eulerAngles;
rotation.z = 0;
this.transform.rotation = Quaternion.Euler(rotation);
mouse_position = Input.mousePosition;

在开始 - 应用程序运行良好,但几分钟后我有错误,来自

  <connectionStrings>
  <add name="RedisConnectionString" connectionString="test.redis.cache.windows.net,ssl=true,password=123,connectTimeout=100000000,syncTimeout=100000000" />
  <add name="ConnectionString" connectionString="Server=tcp:test.cloudapp.net,1433;Database=test;User ID=user;Password=test;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;TrustServerCertificate=True;" />      
  <add name="Entities" connectionString="metadata=res://*/EDM.test.csdl|res://*/EDM.test.ssdl|res://*/EDM.test.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:test.cloudapp.net,1433;initial catalog=test;persist security info=True;user id=user;password=123;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

这里是日志:

System.Data.Entity.Core.EntityClient.EntityConnection.Open()

另外,我尝试将我的连接字符串放在azure web应用程序中,如下所示: enter image description here

但EF连接没有效果。 对于ADO网络连接,它可以正常工作。

此外,EF连接在本地计算机上也能正常工作。

如何在Azure中为EF配置连接字符串? 谢谢!

已编辑:看来,这就是旗帜中的原因:

System.Data.Entity.Core.EntityException: 
The underlying provider failed on Open. ---> 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: TCP Provider, error: 0 - An attempt was made to access a socket in a way forbidden by its access permissions.) ---> 
System.ComponentModel.Win32Exception: An attempt was made to access a socket in a way forbidden by its access permissions

因为,如果将此标志添加到EF连接字符串,它似乎有效...

1 个答案:

答案 0 :(得分:0)

对于Azure中的EF连接字符串,需要将下拉列表更改为自定义。我很惊讶您没有收到元数据错误。

Action String Values