对于SQL Server连接字符串格式正确的1and1.com [英] Proper format for SQL Server Connection String on 1and1.com
问题描述
我已经花了几个小时试图除了搜索这个在网络上调用,并在1and1.com网络发送电子邮件的支持,但没有成功托管。
I have spent several hours trying to search this on the web in addition to calling and emailing support at 1and1.com web hosting with no success.
我有一个使用实体框架连接到MS SQL Server数据库的ASP.NET页面。在我的本地机器上,一切工作正常(自然)。然而,当我修改连接字符串在我的web.config指向我的SQL Server数据库上1and1.com,我得到以下错误:
I have ASP.NET pages which connect to MS SQL Server database using the entity framework. On my local machine, all works fine (naturally). However, when I modify the connection string in my web.config to point to my SQL Server database on 1and1.com, I get the following error:
无法加载指定的元数据的资源。
"Unable to load the specified metadata resource."
下面是我当前的连接字符串(如在我的web.config文件中定义):
Here's my current connection string (as defined in my web.config file):
<add name="TimeDataLicenseEntities"
providerName="System.Data.EntityClient"
connectionString="metadata=res://*/
Model1.csdl|res://*/
Model1.ssdl|res://*/
Model1.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=dbXXXX.db.1and1.com,1433;
Integrated Security=false;
initial catalog=database_name;
user id=dboXXXX;
password=valid_password;multipleactiveresultsets=True"" />
(请注意,如果有XXXX的值在实际的配置文件的不同以及对'数据库名称'和'valid_password')
(Please note that where there are 'XXXX' the values are different in the actual config file as well as for 'database_name' and 'valid_password')
我使用的是实体框架中的code所以我preFER解决方案,纠正我的web.config文件的内容。
I'm using the Entity Framework in the code so I'd prefer solutions that correct the content of my web.config file.
推荐答案
下面是最终为我工作:
<add name="TimeDataLicenseEntities"
providerName="System.Data.EntityClient"
connectionString="metadata=
res://<assemblyname>/Model1.csdl|
res://<assemblyname>/Model1.ssdl|
res://<assemblyname/Model1.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=dbXXXX.db.1and1.com,1433;
Integrated Security=false;
initial catalog=database_name;
user id=dboXXXX;
password=valid_password;
multipleactiveresultsets=True"" />
通过包括上述章节我的code中的的AssemblyName(括号('&LT;'和'>')不应该包括在内),我能够最终得到它的工作。
By including the assemblyname for my code in the sections above (the brackets ('<' and '>') should not be included), I was able to finally get it to work.
谢谢大家的协助。
这篇关于对于SQL Server连接字符串格式正确的1and1.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!