VS2012 Add Service Reference not updating config file

Phil Murray picture Phil Murray · Aug 6, 2013 · Viewed 16k times · Source

I have created a new IIS hosts WCF service using the webHttpBinding which is currently running on on IIS Express on my development machine and when I try to "Add Service Reference" the service is correctly built and the Reference.cs file looks fine but the web.config or app.config files are not being updated.

No warnings or error messages are received.

Both the service and the client are targeting .Net 4.5.

Service config

  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="webInteropSecureBinding" allowCookies="false" maxBufferPoolSize="2097152" maxBufferSize="2097152" maxReceivedMessageSize="2097152">
          <security mode="Transport" />
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="PsmDataProvider.PsmProvider" behaviorConfiguration="SecureRest">
        <clear />
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="webInteropSecureBinding" name="PsmProvider" contract="PsmDataProvider.IPsmProvider" listenUriMode="Explicit" behaviorConfiguration="webHttpBehavior" />
        <endpoint address="mex" binding="mexHttpsBinding" name="mex" contract="IMetadataExchange" listenUriMode="Explicit" />
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost:44300/PsmProvider/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SecureRest">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webHttpBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

Client Config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

Client Service Reference

enter image description here

Following some investigation I found these StackOverflow questions

Question 1

Question 2

Question 3

And this post

Blog post

Each of the above refer to the same problem of unticking the "Reuse types in references assemblies" flag which I have done.

enter image description here

The problem is it did not fix the issue. I have tried updating and deleting and recreating the service reference but it never updates the config file.

Question

Is this a problem with the server side configuration? Or is this an issue with the client side? How to I change either so that the proxy generation works as expected?

Answer

Phil Murray picture Phil Murray · Aug 21, 2013

OK, looks like there are issues in adding a service reference to services that implement the WebHttpBinding WCF binding.

This is discussed in Carlos Figueira Blog Post