本地主机中的 ConnectionString 与实际主机中的 ConnectionString
在本地主机中,我有连接字符串(在 web.config 文件中),如下所示:
<add name="TamizharThalamEntities" connectionString="metadata=res://*/Models.TamizharThalam.csdl|res://*/Models.TamizharThalam.ssdl|res://*/Models.TamizharThalam.msl;provider=System.Data.SqlClient;provider connection string="data source=./SQLEXPRESS; attachdbfilename=|DataDirectory|\TamizharThalam.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
我用 netcetera 托管我的网站。他们告诉我更改连接字符串,如下所示:
数据源 = sql1101.netcetera.co.uk;初始目录 = 您的数据库名称此处;用户 ID = 您的数据库用户名此处;密码 = 您的数据库somepwd
所以更改了 web.config 如下:
data source=sql1101.netcetera.co.uk; Initial Catalog=TamizharThalam;
但是我的网站无法正常工作......
请让我知道如何正确更改连接字符串
In local host I have connectionstring (in web.config file) as below:
<add name="TamizharThalamEntities" connectionString="metadata=res://*/Models.TamizharThalam.csdl|res://*/Models.TamizharThalam.ssdl|res://*/Models.TamizharThalam.msl;provider=System.Data.SqlClient;provider connection string="data source=./SQLEXPRESS; attachdbfilename=|DataDirectory|\TamizharThalam.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
I hosted my site with netcetera..They told me change the connection string as below:
Data Source=sql1101.netcetera.co.uk;Initial Catalog=YOUR DATABASE NAME HERE;User Id=YOUR DATABASE USERNAME HERE;Password=YOUR DATABASEsomepwd
So changed web.config as below:
data source=sql1101.netcetera.co.uk; Initial Catalog=TamizharThalam;
But my website is not working....
Please let me know how to change the connectionString correctly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果连接到 Microsoft SQL 数据库,您的 web.config 键设置应如下所示
If connecting to an Microsoft SQL Database your web.config key setting should look something like this
如果您将连接字符串更改为:
您没有输入登录实例/数据库的凭据。您绝对需要输入用户名和密码(如果您没有使用集成安全性),以便您的应用程序可以对实例/数据库进行身份验证。
ConnectionStrings.com 是迄今为止提供连接字符串帮助的最佳站点,它可以帮助您设置正确的连接字符串。
If you changed your connection string to:
You are not putting in the credentials to log onto the instance/database as. You absolutely need to put in a user name and password (if you're not using integrated security) so that your application can authenticate to the instance/database.
ConnectionStrings.com is by far the best site for connection string help, and it'll get you set up with the correct conn string.