我是 ASP.NET-ville 的新手,请温柔点。
我一直在对 ASP.NET 设置进行故障排除,其中服务器/数据库值正在更改,因此需要更新 web.config。
有多个
实例(多个 ASP.NET 组件),但其中一些实例的标记与其他实例不同。
我提供了以下内容:
<add name="CONNECTION-B" connectionString="metadata=res://*/ZZZZ.ssdl;provider=System.Data.SqlClient;provider connection string="Data Source=XXX;Initial Catalog=YYY;Persist Security Info=True;User ID=AAA;Password=BBBB;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="CONNECTION-A" connectionString="server=XXX;database=YYY;user id=XXX;password=BBB" />
我在上面使用了替换值,并假设对于两种格式类型:
- XXX 是服务器(MSSQL 主机)
- YYY 是数据库名称
- AAA 是数据库用户,
- BBB 是用户密码。
(ZZZZ 是管道分隔的列表)
问题如下:
A)我对同义连接字符串术语的假设是否准确? (数据源 <=> 服务器、数据库 <=> 初始目录)
B) 标记中是否存在语法错误?我查找过的一些 MSDN 文档交替使用双标记、单标记和 "
标记。
I'm new to ASP.NET-ville, be gentle.
I have been troubleshooting a ASP.NET setup, where the server/database values are changing, therefore web.config needs to be updated.
There are multiple <add name="NameXYZ" connectionString="blah" />
instances (multiple ASP.NET components), but some of these are marked up differently to others.
I've got the following provided:
<add name="CONNECTION-B" connectionString="metadata=res://*/ZZZZ.ssdl;provider=System.Data.SqlClient;provider connection string="Data Source=XXX;Initial Catalog=YYY;Persist Security Info=True;User ID=AAA;Password=BBBB;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="CONNECTION-A" connectionString="server=XXX;database=YYY;user id=XXX;password=BBB" />
I've used substituted values in the above, making the assumption that for both format types:
- XXX is the server (MSSQL host)
- YYY is the database name
- AAA is the database user, and
- BBB is the user password.
(ZZZZ is a pipe-delimited list of something)
Questions are as follows:
A) Is my assumption of synonymous connection string terms accurate? (Data Source <=> server, database <=> initial catalog)
B) Are there any syntax errors in the markup? Some MSDN documents I've looked up use double, single, and "
marks interchangeably.
发布评论
评论(3)
这里有两种不同类型的连接字符串。最好的选择(IMO)是阅读文档 -
第一个是 ADO.Net 连接字符串: http://msdn.microsoft.com/en-us/library/ms254500.aspx
第二个是实体框架连接字符串:http://msdn.microsoft.com/en-us/library/cc716756.aspx
这两个链接都解释了,当然比我能解释的更清楚!
There are two different types of connection strings here. The best bet (IMO) is to have a read up in the docs -
The first is an ADO.Net connection string: http://msdn.microsoft.com/en-us/library/ms254500.aspx
The second is an Entity Framework connection string: http://msdn.microsoft.com/en-us/library/cc716756.aspx
It's all explained in those two links, certainly clearer than I can explain it!
可以在这里找到连接字符串信息的重要来源:
http://www.connectionstrings.com/
A great source of connection string information can be found here:
http://www.connectionstrings.com/
我觉得有必要发布此内容,因为我也遇到了一些问题,后来发现 codefirst/model/database 方法的连接字符串要求存在差异:
关于实体框架连接字符串的配置设置的 MS 博客文章
I felt the need to post this since i also had some problems with this and later on discovered that there's a difference in connection string requirements for codefirst/model/database approaches:
MS Blog post about configuration settings for entitiy framework connection strings