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
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.
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?
To update a service reference In Solution Explorer, right-click the service reference and then click Update Service Reference. A progress dialog box displays while the reference is updated from its original location, and the service client is regenerated to reflect any changes in the metadata.
Open Visual Studio. On the start window, choose Create a new project. Type wcf service library in the search box on the Create a new project page. Select either the C# or Visual Basic template for WCF Service Library, and then click Next.
NET Core or . NET Standard project, this option is available when you right-click on the Dependencies node of the project in Solution Explorer and choose Manage Connected Services.) On the Connected Services page, select Add Service Reference. The Add service reference page opens.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With