0
votes

I have a web site hosted on IIS which works ok.

In Visual Studio my project is called Geomaps. It contains a web page that works fine and also a wcf web service.

The web service works fine locally on my dev machine but I am trying to host it on our remote IIS server.

I have no idea how to set this up I have tried various configurations. The web.config in Geomaps is:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
        <services>
            <service name="Service1"
                     behaviorConfiguration="MEX">
                <endpoint
                    address="http://150.158.0.87:8000/MEX"
                    behaviorConfiguration="CountryProvinceBehavior"
                    binding="webHttpBinding"
                    contract="IMetadataExchange" />
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="CommentSessionIDBehavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
                <behavior name="MEX">
                    <serviceMetadata/>
                </behavior>
            </endpointBeahaviors>
        </behaviors>
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

Can someone please help me. I am geting the below error:

Cannot add the 'serviceMetadata' behavior extension to 'MEX' endpoint behavior because the underlying behavior type does not implement the IEndpointBehavior interface

1

1 Answers

0
votes

Try something like this:

<system.serviceModel>
  <services>
    <service name="Service1" behaviorConfiguration="MyMexServiceBehavior">
      <endpoint address="http://150.158.0.87:8000"
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpEndpointBinding"
                contract="MyNamespace.MyIService">
      </endpoint>
      <endpoint address="mex"
                binding="mexHttpBinding"
                contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding"
           maxBufferSize="9000000"
           maxReceivedMessageSize="9000000">
          <security mode = "None" />
        </binding>
      </basicHttpBinding>
      <behavior name="MyMexServiceBehavior">
        <serviceMetadata httpGetEnabled="true"
                         httpGetUrl="http://150.158.0.87:8000/MEX"
                         httpsGetEnabled="false"/>
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="MEX">
        <serviceMetadata/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>