I'm trying to build two webservices with WCF (VS2010).
One webservice runs fine, but when i added a second webservice, then i got the following error:
The contract name 'IMetadataExchange' could not be found in the list
of contracts implemented by the service {0}. Add a
ServiceMetadataBehavior to the configuration file or to the
ServiceHost directly to enable support for this contract.
The second webservice is basically a copy of the first one. So i have no clue why i'm getting this error and how to solve this. Anyone any idea what the problem might be?
Here is my App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="WcfEmguCV1.Service1Behavior" name="WcfEmguCV1.EvalService">
<endpoint address="" binding="wsHttpBinding" contract="WcfEmguCV1.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfEmguCV1/Service1/" />
</baseAddresses>
</host>
</service>
<service name="WcfEmguCV1.Image">
<endpoint binding="wsHttpBinding" bindingConfiguration="" contract="WcfEmguCV1.IIMage">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfEmguCV1/Service2/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfEmguCV1.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- 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>
<behavior name="WcfEmguCV1.Service2Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- 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>
</system.serviceModel>
</configuration>
I found my problem. First of all, i was adding new data to the App.config through "Edit WCF Configuration" option. (Right click on the App.config file and you should see that option).
Since the first webservice config was already by default there, i had to add a new one. So i tried to enter the exact same data. But some things can't be added through that method.
Because when i took a closer look at my XML file i noticed i was missing this for the 2nd webservice:
<service behaviorConfiguration="WcfEmguCV1.Service1Behavior" ...>
So all i had to do was to add that to the 2nd node of 'service'.
behaviorConfiguration="WcfEmguCV1.Service2Behavior"
Related
I hosted my WCF Service using Windows Service, but when I call the WCF method I get the following error:
System.ServiceModel.ServerTooBusyException: The HTTP service located
at
http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/
is too busy. ---> System.Net.WebException: The remote server returned
an error: (503) Server Unavailable.
The App.Config in my WCF Service and Windows Service is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="RahatWcfServiceLibrary.ServerDateTimeBehavior" name="RahatWcfServiceLibrary.ServerDateTime">
<endpoint address="" binding="wsHttpBinding" contract="RahatWcfServiceLibrary.IServerDateTime">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/mex" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RahatWcfServiceLibrary.ServerDateTimeBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="60" maxConcurrentSessions="60"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I solved the issue by adding '/mex' at the end of endpoint address in App.Config file in Windows Application that consumes the service.
<endpoint address="http://localhost:8733/Design_Time_Addresses/RahatWcfServiceLibrary/ServerDateTime/mex"
IN my WCF Service, the WCF Test Client reports the following error
System.InvalidOperationException: Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
My App.Config is this:
<?xml version="1.0" encoding="utf-8" ?>
<services>
<service name="Practicon.SAPServiceLibrary.SAPDownloadService" behaviorConfiguration="debug">
<endpoint address="net.tcp://localhost:8082/SAPDownloadService" binding="netTcpBinding" contract="Practicon.SAPServiceLibrary.ISAPDownloadService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<!--add baseAddress="http://localhost:8083/Design_Time_Addresses/Practicon/SAPServiceLibrary/SAPDownloadService/"/> -->
<add baseAddress="net.tcp://localhost:8082/SAPDownloadService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<!--<serviceMetadata httpGetEnabled="false" httpsGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint name="PracticonSAPDownloadEndPointClient"
address="net.tcp://localhost:8082/SAPDownloadService"
binding="netTcpBinding"
bindingConfiguration="BindingConfiguration"
contract="Practicon.SAPServiceLibrary.ISAPDownloadService">
<identity>
<servicePrincipalName value=""/>
</identity>
</endpoint>
</client>
<bindings>
<netTcpBinding>
<binding name="BindingConfiguration"
transferMode="Buffered"/>
</netTcpBinding>
</bindings>
I have got a net.tcp Endpoint - the Service runs fine, just that this error is reported in the WCF Hosting.
Can someone explain what I've done wrong and how to correct it?
Thanks
MM
I am using a wcf service to provide some data to my clients to plot a graph .I have seen some thing and created the service But when I run it is showing following error.How to over come it?
The type 'WcfService2.Servi', provided as the Service attribute value in theServiceHostdirective, or provided in the configuration elementsystem.serviceModel/serviceHostingEnvironment/serviceActivationscould not be found.
this is my web.config file
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfService2.Servi" behaviorConfiguration="WcfService1.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" contract="WcfService2.Servi" behaviorConfiguration="web" bindingConfiguration="crossDomain">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- 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>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="crossDomain" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Your service contract type is called WcfService2.Servi. This looks like a typo. If you correct this, does the service work?
I try to build an application to send messages between 2 machines usinf WCF according this article: http://www.youtube.com/watch?v=1-BYIQQYwjQ
After follow all the steps and when the server and the client runs on the same machine all works fine.
when moved my Client (simple console application) to another machine i have changed localhost from http://localhost:8733/MySampleWCFService/ to my machine IP address (both machines in the same network and there is no Firewall running but received the error
There was no endpoint listening
This is my App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WCFServiceHostingInWinService.MySampleWCFService">
<endpoint
name="ServiceHttpEndPoint"
address=""
binding="basicHttpBinding"
contract="WCFServiceHostingInWinService.IMySampleWCFService">
</endpoint>
<endpoint
name="ServiceMexEndPoint"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/MySampleWCFService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- 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="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Maybe it could be an permissions issue ?
I have an WCF it is run Successfully when i run it my local host. But i face a problem when run it against a specific domain address(www.esimsol.com). Any one help me how can i config it for ("http://www.esimsol.com/evalservicesite/eval.svc"). My local host config file is :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="EvalServiceLibrary.Service1Behavior"
name="EvalServiceLibrary.EvalService">
<endpoint address="" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EvalServiceLibrary.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- 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>
</system.serviceModel>
</configuration>
Note : Specially base Address
Remove
<identity>
<dns value="localhost" />
</identity>
&
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/EvalServiceLibrary/EvalService/" />
</baseAddresses>
</host>
you have to publish your solution to your iis server with name http://www.esimsol.com.
after publishing it try running your service with address:http://www.esimsol.com/evalservicesite/eval.svc
and change your base addresss to
you cannot use your loacalhost server 8081 after publishing it to any server either it should be localhost or your website name http://www.esimsol.com