我創建了一個WCf服務,它具有一個可以使用WebGET屬性接收GET請求的方法,我希望同樣的方法也可以接收Soap調用(當程序員對WCF執行服務引用時,他將能夠調用該方法)。接收GET和SOAP請求的WCF方法
我的界面:
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "GetData?value={value}")]
string GetData(int value);
}
我的配置是:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WCFTestingGetService.Service1" behaviorConfiguration="MyServiceBehavior" >
<endpoint address="" binding="webHttpBinding" contract="WCFTestingGetService.IService1" behaviorConfiguration="WebBehavior"></endpoint>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
我可以讓德Web方法的GetData一個HTTP GET和SOAP的方法?
我需要將什麼添加到配置?
我刪除了Webget屬性並使用了Basichttpbinding,現在WCFtestClient不起作用。 我的配置是: <端點地址= 「」 綁定= 「basicHttpBinding的」 合同= 「WCFTestingGetService.IService1」 behaviorConfiguration = 「WebBehavior」> 是它好嗎? 如果我刪除Webget,我可以使用瀏覽器工作嗎? – Rodniko 2010-09-01 08:19:53
還要添加 ,並確保在servicebehavior部分有這個: –
2010-09-01 08:32:32