VS2012 Add Service Reference not updating config file
Asked Answered
C

4

14

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?

Contrariety answered 6/8, 2013 at 11:15 Comment(0)
C
7

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

Contrariety answered 21/8, 2013 at 7:58 Comment(2)
This was the cause of my issue. WCF services configured to act like RESTful services have this issue when generating service references from Visual StudioJacky
What's the solution then? Is it not possible to consume this WCF services in a console application?Osteogenesis
B
0

Remove maxBufferPoolSize="2097152" maxBufferSize="2097152" from your web.config file. Then try to update your service. Make sure your Bindings are correctly mentioned.

Barque answered 21/8, 2013 at 6:31 Comment(2)
I removed all the options on the binding, deleted and recreated the service reference but it did not resolve the problem.Contrariety
You have to binding. But it is in proper way.Barque
D
0

I had the same problem again today with VS2012.

I have a set of Test, PreProduction and Production web.config configurations, I could use "Preview transformation", and see that VS2012 was patching my "web.config" with the relevant settings..

Preview

...but... when I deployed, well, it just seemed to include the default "web.config" file without any changes.

The cause was that VS2012 seemed to have messed up its configurations, and in the Publish dialog, suddenly my PreProduction configuration was associated with Debug. Huh ?

Publish

Changing this from "Debug" to "PreProduction" fixed the issue for me.

Or, at least, it nudged me a step forward, but I'm still having an issues with VS2012 messing up my configuration names when it tries to deploy.

Deploy

(Depressed sigh.)

Currently downloading VS2013. Hopefully, this release will be less buggy.

Dissuasive answered 19/2, 2014 at 7:56 Comment(0)
A
0

In my case, it was caused by I set a binding parameter wrong on the web service side.

binding.ReliableSession.InactivityTimeout = TimeSpan.Maximum;

After set this to System.TimeSpan(0, 10, 0); the binding configuration is generated in web.config file.

Alexipharmic answered 30/9, 2014 at 5:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.