Tsukasa
Tsukasa

Reputation: 6552

accessing WCF web service

I created a service in WCF and published it to the IIS server via FTP.

When I add a service reference to the WPF program that will be using it I get there was no service found at the given url.

When I navigate to the location on the IIS server to view errors I get the following

Service has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

I'm referencing it by using

https://site/folder/MyService.svc

What might I be missing here?

added web.config

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

<system.web>
 <compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="false"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Upvotes: 2

Views: 1286

Answers (1)

marc_s
marc_s

Reputation: 754468

You're not giving us much to go on....

The error says clearly: the service on your server doesn't define any service endpoints - no endpoints, no connection.

You'll need to check your server-side web.config file.

Do you have a <system.serviceModel> / <services> / <service> node in there? What does it say? Could you possibly update your original question and show us the server-side web.config (the <system.serviceModel> section of it)

A common mistake is that the <service name="...." /> attribute must exactly match the fully-qualified class name (class name including namespace) of the class that actually implements your service contract - the concrete class (not the interface!) that actually contains the service code.

Update:

a typical / minimal <service> tag might look like this:

<system.serviceModel>
   <services>
      <service name="NameSpace.YourServiceImplementationClass>
          <endpoint name="DefaultEndpoint"
              address=""   -- no need to specify if you're hosting in IIS
              binding="basicHttpBinding"   -- defines the protocol to use to talk to your endpoint
              contract="NameSpace.IYourServiceContract" />
      </service> 
   </services>
</system.serviceModel>

Of course, you can add more configuration as needed - you'll need to pick the binding as your first step - how (using what protocol and what settings) are your clients going to talk to your service?

Upvotes: 2

Related Questions