如何设置通过Windows Azure(preVIEW)管理门户的ADO.NET实体框架连接字符串? [英] How do I set an ADO.NET Entity Framework connection string via the Windows Azure (Preview) Management Portal?

查看:140
本文介绍了如何设置通过Windows Azure(preVIEW)管理门户的ADO.NET实体框架连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Azure(preVIEW)管理门户您可以更改网站的配置选项(请参阅http://www.windowsazure.com/en-us/manage/services/web-sites/how-to-configure-websites/#howtochangeconfig).

In the Windows Azure (Preview) Management Portal you can change the configuration options for web sites (see http://www.windowsazure.com/en-us/manage/services/web-sites/how-to-configure-websites/#howtochangeconfig).

我目前定为通过Web.Release.Config我的ADO.NET实体框架连接的连接字符串,但我想通过管理门户来进行设置,但无论我用什么,我总是用下面的错误结束

I currently set the connection string for my ADO.NET Entity Framework connection via Web.Release.Config, but I want to set it via the Management Portal, but no matter what I use, I always end up with the following error:

指定命名连接或者未在发现
  配置,不打算与EntityClient提供者使用,
  或无效。

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

它做定期连接字符串的工作,即没有元数据定义关键元数据和映射信息(CSDL,SSDL,MSL)。

It does work for regular connection strings, ie without the metadata key defining metadata and mapping information (csdl, ssdl, msl).

下面是我做的:

我去<一个href=\"https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/[MY-STAGING-SITE-NAME]/configure\">https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/[MY-STAGING-SITE-NAME]/configure

在连接字符串我有一个关键名为ApplicationServices,看起来像这样:

Under "connection strings" I have a key named "ApplicationServices" that looks like this:

服务器= TCP:xxxxx.database.windows.net,1433;数据库= XXXXX;用户
  ID = XXXXX @ XXXXX;密码= XXXXX; Trusted_Connection = FALSE;加密= TRUE;连接
  超时= 30;

Server=tcp:xxxxx.database.windows.net,1433;Database=xxxxx;User ID=xxxxx@xxxxx;Password=xxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;

这一件作品。

我有实体框架连接的另一关键。让我们把一个FooBarContext。它看起来是这样的:

I have another key for the Entity Framework connection. Let's call that one FooBarContext. It looks like this:

metadata=res:///Models.FooBarContext.csdl|res:///Models.FooBarContext.ssdl|res://*/Models.FooBarContext.msl;provider=System.Data.SqlClient;provider
  连接
  字符串=服务器= TCP:fooserver.database.windows.net,1433;数据库= foobar的;用户
  ID = MYNAME @ fooserver;密码= XXXXXXXXXX; Trusted_Connection = FALSE;加密= TRUE;连接
  超时= 30;

metadata=res:///Models.FooBarContext.csdl|res:///Models.FooBarContext.ssdl|res://*/Models.FooBarContext.msl;provider=System.Data.SqlClient;provider connection string="Server=tcp:fooserver.database.windows.net,1433;Database=foobar;User ID=myname@fooserver;Password=xxxxxxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"

这一次导致上述错误。它是从工作在Web.Release.Config值复制,与和放大器; QUOT;被取代。

This one causes the error described above. It is copied from the working value in Web.Release.Config, with the &quot; replaced by a ".

我已经试过其他的变化:与&放大器; QUOT;不变,并在最后追加的元数据,但无济于事。我有一个第二个网站转载的问题。

I have tried other variations: with the &quot; untouched, with metadata appended at the end, but to no avail. I have reproduced the problem with a second website.

推荐答案

我的问题的解决方案是选择的自定义而不是SQL Azure的从 SQL Azure的/ SQL服务器/ MySQL的/自定义选择为实体框架的连接字符串,即使数据库不上的SQL Azure上运行。

The solution for my problem was selecting "Custom" instead of "SQL Azure" from the "SQL Azure / SQL Server / MySQL / Custom" selector for the Entity Framework connection string, even though the database does run on SQL Azure.

这篇关于如何设置通过Windows Azure(preVIEW)管理门户的ADO.NET实体框架连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆