【发布时间】:2012-08-22 07:50:14
【问题描述】:
我喜欢 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>
【问题讨论】:
-
应该是 system.serviceModel/client/endpoint,而不是 configuration/endpoint。
-
那行不通。我之前使用 Web.config 完成了它,但没有添加所有内容。我在更改的内容上方进行了编辑
-
先尝试使用connectionStrings来匹配默认配置文件。
-
对不起,没用..见上文...也很奇怪的是...两种方式,数据库转换都有效,但端点没有...这是我拥有的另一个项目中的问题好
-
我不知道该告诉你什么,今天早上我回到了我的开发机器上并尝试了它,并使用我的第一个建议我的配置正在按预期进行转换。
标签: wcf windows-services app-config slowcheetah