我喜欢 SlowCheetah,但在我的 app.config 中转换端点时遇到了一些问题。我希望也许有人可以看一下,看看我错过了什么或过去遇到过这个问题。
app.config 默认值
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/RFPModel.csdl|res://*/RFPModel.ssdl|res://*/RFPModel.msl;provider=System.Data.SqlClient;provider connection string="data source=developmentServer;initial catalog=databaseName;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMasterEngineService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://DevelopmentServer/WebServices/MasterEngine/MasterEngineService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMasterEngineService" contract="OverlayFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" />
</client>
</system.serviceModel>
</configuration>
发布的转换是:
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/RFPModel.csdl|res://*/RFPModel.ssdl|res://*/RFPModel.msl;provider=System.Data.SqlClient;provider connection string="data source=releaseServer;initial catalog=databaseName;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</connectionStrings>
<endpoint address="http://productionServer/WebServices/MasterEngine/MasterEngineService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMasterEngineService" contract="OverlayFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" xdt:Transform="Replace" xdt:Locator="Match(name)">
</endpoint>
</configuration>
我做的是正常的,创建配置并确保在构建之前我处于正确的配置/环境中,但无论我做什么,即使选择发布环境/配置,它也会保持相同的开发服务器。
有任何想法吗?
-- 更新 -- 根据请求,尝试:
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.serviceModel>
<client>
<endpoint address="http://productionServer/WebServices/MasterEngine/MasterEngineService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMasterEngineService" contract="OverlayFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</client>
</system.serviceModel>
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/RFPModel.csdl|res://*/RFPModel.ssdl|res://*/RFPModel.msl;provider=System.Data.SqlClient;provider connection string="data source=databaseName;initial catalog=dash;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</connectionStrings>
</configuration>
没用
-再次更新---
首先尝试了您对 connectionString 的建议..无济于事
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/RFPModel.csdl|res://*/RFPModel.ssdl|res://*/RFPModel.msl;provider=System.Data.SqlClient;provider connection string="data source=databaseName;initial catalog=dash;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</connectionStrings>
<client>
<endpoint address="productionServerName/WebServices/MasterEngine/MasterEngineService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMasterEngineService" contract="OverlayFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</client>
</configuration>