나는 휴식과 비누로 모두 드리고 싶은 서비스를 작성했습니다. WCF 4.0에 대해 읽은 모든 내용은이 작업을 수행하기 위해 서로 다른 동작을 가진 2 개의 끝점을 노출해야한다고 말합니다. 그러나 나는 그것을 작동시킬 수 없다.WCF 비누와 나머지 끝점을 나란히 호스팅
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="MyService">
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="MyService"/>
<endpoint address="rest" behaviorConfiguration="restBehavior" binding="webHttpBinding" contract="MyService" />
<endpoint address="soap" behaviorConfiguration="soapBehavior" binding="basicHttpBinding" contract="MyService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp automaticFormatSelectionEnabled="true" helpEnabled="true" />
</behavior>
<behavior name="soapBehavior" />
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
내 서비스 URL을 정의 할 라우팅을 사용하고 있습니다 :
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new ServiceRoute("dns", new ServiceHostFactory(), typeof(MyService)));
}
}
가 여기
[ServiceContract]
public interface MyService
{
[OperationContract]
[WebGet(UriTemplate="data/{value}")]
string GetData(string value);
}
내 Web.config의이다 : 여기
내 서비스 계약입니다 내가 여기서 잘못하고있는 것? 나는 약간의 도움을 정말로 사용할 수있다.
나는이 다른 [질문/답] (http://stackoverflow.com/questions/186631/rest-soap-endpoints-for-a-wcf 발견 -service) 도움이됩니다. – SMB