2012-01-17 2 views
1

다음 구성으로 Azure에서 webrole으로 호스팅되는 WCF 응용 프로그램이 있습니다. 브라우저에서 3 개의 서비스 wsdl 중 하나에 액세스하려고하거나 프록시를 설정할 때 400 개의 잘못된 요청이 표시됩니다.이 WCF 구성으로 인해 400 번의 잘못된 요청이 발생합니까?

<?xml version="1.0"?> 
    <configuration> 

     <appSettings> 
     </appSettings> 

     <system.web> 
      <customErrors mode="Off"></customErrors> 
      <compilation debug="true" targetFramework="4.0" /> 
     </system.web> 

     <connectionStrings></connectionStrings> 

     <system.diagnostics>  
     <sharedListeners> 
      <add name="AzureLocalStorage" type="Example.AzureLocalStorageTraceListener, Example"/> 
     </sharedListeners> 
     <sources> 
      <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing"> 
      <listeners> 
       <add name="AzureLocalStorage" /> 
      </listeners> 
      </source> 
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose"> 
      <listeners> 
       <add name="AzureLocalStorage" /> 
      </listeners> 
      </source> 
     </sources> 
     </system.diagnostics> 

     <system.serviceModel> 
      <services> 
       <service name="Service1" behaviorConfiguration="MetaBehavior"> 
        <endpoint address="http://example.com/service1.svc" binding="basicHttpBinding" name="basicEndpoint1" contract="IService1" /> 
       </service> 
       <service name="Service2" behaviorConfiguration="MetaBehavior"> 
        <endpoint address="http://example.com/service2.svc" binding="basicHttpBinding" name="basicEndpoint2" contract="IService2" /> 
       </service> 
       <service name="Service3" behaviorConfiguration="MetaBehavior"> 
        <endpoint address="http://pexample.com/service3.svc" binding="basicHttpBinding" name="basicEndpoint3" contract="IService3" /> 
       </service> 
      </services> 
      <behaviors> 
       <serviceBehaviors> 
        <behavior name="MetaBehavior"> 
         <serviceDebug includeExceptionDetailInFaults="true" /> 
         <serviceMetadata httpGetEnabled="true"/> 
         <serviceThrottling maxConcurrentSessions="90" /> 
        </behavior> 
       </serviceBehaviors> 
      </behaviors> 
      <serviceHostingEnvironment multipleSiteBindingsEnabled="false" aspNetCompatibilityEnabled="true" /> 
     </system.serviceModel> 

     <system.webServer> 
      <modules runAllManagedModulesForAllRequests="true"/> 
     </system.webServer> 

    </configuration> 

나는 내 구성이 올바르지 않다는 것을 확신하지만 잘못된 것이 무엇인지 약간의 지침이 필요합니다. 로

인터페이스

가 정의 : 당신은 잘못된 바인딩을 사용하고

[ServiceContract(Name = "Service1", Namespace = "http://example.com")] 
public interface IService1 
{ 
    [WebGet] 
    [OperationContract] 
    Result Create(); 
} 

답변

3

대신은 BasicHttpBinding의 WebHttpBinding이라는보십시오. 귀하의 계약은 WCF가 준 REST 기반 서비스를받는 WebGet으로 설정됩니다. BasicHttpBinding은 비누 기반 바인딩에만 사용됩니다 (따라서 "잘못된 요청"예외).

편집 : WebGet이 있었기 때문에 나는 비누 끝점을 원하지 않는다고 생각했습니다. 아래는 비누와 WebGet을 모두 지원하는 설정입니다. Azure가 표준 IIS에서 얼마나 다른지 알 수는 없지만 서비스에 대해 상대 주소를 사용해야합니다. IIS는 서비스 구성의 상대 주소 만 지원합니다.

<system.serviceModel> 
    <services> 
     <service name="Service1" behaviorConfiguration="Service.Behavior"> 
      <endpoint address="Service1" 
         binding="basicHttpBinding" 
         contract="IService1" 
         bindingNamespace = "http://example.com" 
         bindingConfiguration="HttpBasic" /> 
      <endpoint address="mexService1" 
         binding="mexHttpBinding" 
         contract="IMetadataExchange" 
         bindingNamespace = "http://example.com"/> 
      <endpoint address="webService1" 
         binding="webHttpBinding" 
         behaviorConfiguration="webBehavior" 
         contract="IService1" 
         bindingNamespace = "http://example.com" 
         name="webHttp" 
         listenUriMode="Explicit" /> 
     </service> 
     <service name="Service2" behaviorConfiguration="Service.Behavior"> 
      <endpoint address="Service2" 
         binding="wsHttpBinding" 
         contract="IService2" 
         bindingNamespace = "http://example.com" 
         bindingConfiguration="HttpStandard" /> 
      <endpoint address="mexService2" 
         binding="mexHttpBinding" 
         contract="IMetadataExchange" 
         bindingNamespace = "http://example.com"/> 
      <endpoint address="webService2" 
         binding="webHttpBinding" 
         behaviorConfiguration="webBehavior" 
         contract="IService2" 
         bindingNamespace = "http://example.com" 
         name="webHttp" 
         listenUriMode="Explicit" /> 
    </services>  
    <behaviors> 
     <endpointBehaviors> 
      <behavior name="webBehavior" > 
       <webHttp /> 
      </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
      <behavior name="Service.Behavior"> 
       <serviceMetadata httpGetEnabled="true"/> 
       <serviceDebug includeExceptionDetailInFaults="false"/> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="HttpBasic" receiveTimeout="00:10:00" maxReceivedMessageSize="2048000"> 
       <security mode="None"/> 
      </binding> 
     </basicHttpBinding> 
     <wsHttpBinding> 
      <binding name="HttpStandard" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2048000"> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> 
        <message clientCredentialType="None" negotiateServiceCredential="false" algorithmSuite="Default" establishSecurityContext="false" /> 
       </security> 
      </binding> 
      <binding name="Https" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2048000"> 
       <security mode="Transport"> 
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> 
        <message clientCredentialType="None" negotiateServiceCredential="false" algorithmSuite="Default" establishSecurityContext="false" /> 
       </security> 
      </binding> 
      <binding name="HttpsAuthenticated" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2048000"> 
       <security mode="Transport"> 
        <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
</system.serviceModel> 
+0

SOAP을 사용하려면 올바른 구성은 무엇입니까? – Digbyswift

+1

비누와 WebGet을 모두 지원하도록 WCF를 구성 할 수 있습니다. 나는 대답을 넓혔다. –

관련 문제