I am currently using Visual Studio 2010. I want to set up a different connection string for my "Testing" Configuration. I have tried doing it by using config transformations, but it does not seem to work.
在我的<星座>Web.config上,我的联系人如下:
<add name="MyDb" connectionString="Data Source=.SQLEXPRESS;Initial Catalog=DevelopmentDb;Integrated Security=SSPI; MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
我发现,你可以取代网络界定的连接线,添加“组合转变”。 我在网上被点击,并点击“Add config transformations”。 这创造了一个<><>>>>。 Web.TEST.config file. 然后,我又增加了一条连接线,但似乎正在发挥作用。 它仍在使用Web.config界定的连接线。
http://strong。 Web.TEST.config:
<?xml version="1.0"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an atrribute "name" that has a value of "MyDB".
-->
<connectionStrings>
<add name="MyDb"
connectionString="Data Source=.SQLEXPRESS;Initial Catalog=TestDb;Integrated Security=SSPI; MultipleActiveResultSets=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
对我可能失踪的任何想法?