ASP.NET 连接字符串元数据语法

发布于 2024-11-10 04:41:22 字数 1001 浏览 3 评论 0 原文

我是 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=&quot;Data Source=XXX;Initial Catalog=YYY;Persist Security Info=True;User ID=AAA;Password=BBBB;MultipleActiveResultSets=True&quot;" 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 文档交替使用双标记、单标记和 &quot; 标记。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷离° 2024-11-17 04:41:22

这里有两种不同类型的连接字符串。最好的选择(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!

看透却不说透 2024-11-17 04:41:22

可以在这里找到连接字符串信息的重要来源:

http://www.connectionstrings.com/

A great source of connection string information can be found here:

http://www.connectionstrings.com/

许仙没带伞 2024-11-17 04:41:22

我觉得有必要发布此内容,因为我也遇到了一些问题,后来发现 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文