Strange exception when connecting to a WCF service through a proxy server

Exception: This operation is not supported for relative URIs. "occurs in the following situation:

I have a WCF service:

[ServiceContract(ProtectionLevel=ProtectionLevel.None)]
public interface IMyService
{
    [OperationContract]
    [FaultContract(typeof(MyFault))]
    List<MyDto> MyOperation(int param);

    // other operations
}

public class MyService : IMyService
{
    public List<MyDto> MyOperation(int param)
    {
        // Do the business stuff and return a list of MyDto
    }

    // other implementations
}

MyFaultand MyDto- two very simple classes marked with an attribute [DataContract], and each of them has only three [DataMember]types string, int and int?.

This service is hosted in IIS 7.0 on a Win 2008 Server along with an ASP.NET application. I am using the SVC file MyService.svc, which is located directly in the root directory of the website. The service configuration in web.config is as follows:

<system.serviceModel>
  <services>
    <service name="MyServiceLib.MyService">
      <endpoint address="" binding="wsHttpBinding"
          bindingConfiguration="wsHttpBindingConfig" 
          contract="MyServiceLib.IMyService" />
    </service>
  </services>
  <bindings>
    <wsHttpBinding>
      <binding name="wsHttpBindingConfig">
        <security mode="None">
          <transport clientCredentialType="None" />
        </security>
      </binding>
    </wsHttpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="false"/>
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

, , , http://www.domain.com/MyService.svc " Windows Communication Foundation " - .

, , :

MyServiceClient aChannel = new MyServiceClient("WSHttpBinding_IMyService");
List<MyDto> aMyDtoList = aChannel.MyOperation(1);

:

<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="true" transactionFlow="false"
          hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="false"
          proxyAddress="10.20.30.40:8080" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192"
              maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows"
                negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://www.domain.com/MyService.svc" binding="wsHttpBinding"
          bindingConfiguration="WSHttpBinding_IMyService"
          contract="MyService.IMyService"
          name="WSHttpBinding_IMyService" />
    </client>
</system.serviceModel>

, aChannel.MyOperation(1), :

URI.

, , , proxyAddress="10.20.30.40:8080" , .

, - URI. - - , .

- , , , ?

!

Edit:

, : WCF .NET Framework 4.

+5
1

10.20.30.40:8080 URL. http://10.20.30.40:8080.


, -:

  • . , . , , .
  • : " URI". , , , URL-, URI.
  • OP , " , proxyAddress =" 10.20.30.40:8080 " ".

, , URI. , "" , , URI, "", .

, . , URI scheme://, .

+8

All Articles