我認爲自己在WCF方面非常專業,但這讓我很難過。我不知道這是一個.NET Framework 4/WCF 4的東西,它是自動配置還是什麼,但我得到奇怪的行爲。我基本上有一個在IIS項目中託管的WCF 4 WCF服務。這一切工作,然後我去了,並從basicHttpBinding配置切換到wsHttpBinding。我試圖更新我的消費應用程序中的服務引用,並在生成的配置中獲取basicHttpBinding輸出。所以,當然,我放下並運行svcutil.exe重複.svc文件和相同的結果。這是配置文件(布拉赫取代,我不能公開使用的名字):WCF IIS託管的wsHttpBinding服務 - svcutil使用basicHttpBinding生成代理!
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows"></authentication>
<identity impersonate="true"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpEndpointBinding">
<security mode="Message">
<message clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Blah.Services.RONScheduler.BlahService.BlahDataServiceBehavior"
name="Blah.Services.RONScheduler.FAMService">
<endpoint address="BlahDataService" binding="wsHttpBinding" bindingConfiguration="WSHttpEndpointBinding"
name="WSHttpEndpoint" contract="Blah.Services.RONScheduler.FAMService.IBlahDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Blah.Services.RONScheduler.BlahService.BlahDataServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
這是我得到生成的內容之前,我清理掉unncessary東西:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IBlahDataService" 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://localhost/BlahService/BlahDataService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBlahDataService"
contract="IBlahDataService" name="BasicHttpBinding_IBlahDataService" />
</client>
</system.serviceModel>
由於你可以看到它就像忽略了配置中的wsHttpBinding設置。是什麼賦予了?
對,我忘了那個。好像配置應該覆蓋這個不是?您應該能夠使用config覆蓋defqaualts,否則整個配置系統都會中斷。 – 2010-10-26 17:46:22
「指南」指出:「或者如果您只想在應用程序範圍內覆蓋它,則可以在應用程序/ Web配置文件中覆蓋此部分。」 – 2010-10-26 18:00:30
這就是無效。 – 2010-10-26 18:00:47