在Windows Azure(预览)管理门户中,您可以更改网站的配置选项(请参阅http://www.windowsazure.com/en-us/manage/services/web-sites/how-to-configure-websites/ #howtochangeconfig).
我目前通过Web.Release.Config为我的ADO.NET实体框架连接设置连接字符串,但我想通过管理门户设置它,但无论我使用什么,我总是最终得到以下错误:
指定的命名连接在配置中找不到,不打算与EntityClient提供程序一起使用,或者无效.
它适用于常规连接字符串,即没有定义元数据和映射信息的元数据键(csdl,ssdl,msl).
这是我做的:
在"连接字符串"下,我有一个名为"ApplicationServices"的键,如下所示:
Server = tcp:xxxxx.database.windows.net,1433; Database = xxxxx; User ID = xxxxx @ xxxxx; Password = xxxxx; Trusted_Connection = False; Encrypt = True; Connection Timeout = 30;
这个工作.
我有另一个用于Entity Framework连接的密钥.我们称之为一个FooBarContext.它看起来像这样:
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中的工作值复制的,带有" 取而代之的是".
我尝试了其他变体:" 未触及,最后添加了元数据,但无济于事.我已经通过第二个网站重现了这个问题.
deployment entity-framework connection-string azure azure-web-sites