0
votes

I have a wcf service that I tried to add using both svcutil and by adding service reference to the client test project. In both cases a new config file was not created and subsequently the client test will not run due to it not seeing the endpoints. Why is this the case and here is my web.config file for the WCF service.

<?xml version="1.0"?>
<configuration>

<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
  <webHttpBinding>
    <binding name="webHttpBinding" crossDomainScriptAccessEnabled="true" />
  </webHttpBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="webHttpBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
 <service behaviorConfiguration="webHttpBehavior" name="WcfInstanceRules2.Service1">
    <endpoint address="" 
    binding="webHttpBinding" bindingConfiguration="webHttpBinding"   
    contract="WcfInstanceRules2.IService1" 
    behaviorConfiguration="web"/>
  </service>
</services>

1
Might be obvious, but do you have an existing config file in your client app? I'd also give your bindingConfiguration a different name than the binding name ex: bindingConfiguration="webHttpBindingConfiguration" - Mark B
yes there is an existing web.config file in the client. I will change the bindingconfi name - vbNewbie
Consuming your service shouldn't create a new config file though. It should just add a client node to your existing file. Again, that might be obvious, but your OP suggests you're looking for a file to be created upon consumption. - Mark B
i got this from the tutorial used to create a WCF that a new config file should be produced. however there is also no addition of a client node to the original config file. - vbNewbie

1 Answers

1
votes

If you're using the webHttpBinding then you're writing a RESTful service, right? REST services aren't "consumed" via Visual studio or via SvcUtil.exe like other SOAP based services (for example, that would use a SOAP based binding like basicHttpBinding, or wsHttpBinding etc). You would "consume" the service by calling it from something like jQuery:

$.getJSON("Service1.svc/uriTemplateNameHere", { param: myParameter },
            function (result) {
                // do something
            });

Can you post your WCF code?