Could not find endpoint element - wcf

The errror message is:
Could not find endpoint element with name
'NetbiterServiceReference.nbws' and contract
'NetbiterServiceReference.nbws' in the ServiceModel client
configuration section.
My app.config file looks like this:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="nbws.cfcSoapBinding">
<security mode="Transport" />
</binding>
<binding name="nbws.cfcSoapBinding1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://../nbws.cfc"
binding="basicHttpBinding" bindingConfiguration="nbws.cfcSoapBinding"
contract="NetbiterServiceReference.nbws" name="nbws.cfc" />
</client>
</system.serviceModel>
In my code I do like this and i gives the error message above.
nbwsClient proxy = new nbwsClient();
Then I did all these combinations, but with the same result:
nbwsClient proxy = new nbwsClient("NetbiterServiceReference.nbws", "https://../nbws.cfc");
nbwsClient proxy = new nbwsClient("nbws", "https://../nbws.cfc");
nbwsClient proxy = new nbwsClient("nbws.cfc", "https://../nbws.cfc");
Any ideas would be appreciated!

The errror message is: Could not find endpoint element with name 'NetbiterServiceReference.nbws' and contract 'NetbiterServiceReference.nbws' in the ServiceModel client configuration section. My app.config file looks like this:
If you change the endpoint section as follows, you'll lose this error.
<endpoint address="https://../nbws.cfc"
binding="basicHttpBinding" bindingConfiguration="nbws.cfcSoapBinding"
contract="NetbiterServiceReference.nbws" name="NetbiterServiceReference.nbws" />

Resolved it myself.
Problem was that the test-project, running the project with code and app.config didn’t have the correct information in the app.config.

Related

WCF Endpoint does not use provided Https binding

I'm calling an external WCF service and am getting the following error message. "The provided URI scheme 'http' is invalid; expected 'https'. Parameter name: via"
here are the config sections pertaining to the service:
<client>
<endpoint address="https://www.odfl.com:443/wsRate_v4/RateService" binding="basicHttpBinding" bindingConfiguration="RatePortBinding" contract="OdflRateService.RateDelegate" name="RatePort" />
</client>
and the binding Section:
<bindings>
<basicHttpBinding>
<binding name="RatePortBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
The assembly is calling the service is loaded into the app through reflection and the configuration values are in the main app web config. I don't know if this makes any difference but thought i should mention it.
Thanks!

WCF/SSL error: Failed to lookup a channel to receive an incoming message

I've been having a difficult time getting a WCF call in Silverlight to work when using SSL. I've gotten it to a point where WCF tracing says the endpoint is listening but when my code tries to call a function on it WCF Tracing shows the error:
Failed to lookup a channel to receive an incoming message. Either the endpoint or the SOAP action was not found.
If I browse to the services URL I properly get the service page, but calling it in code it always fails. Again, this only happens on HTTPS, not before when I was using HTTP. Of course there were a number of config changes to add to use SSL. I should note that the WCF Domain Services functions work fine over SSL, just not the WCF Service. Below are my various config file sections
Web.config
<system.serviceModel>
<domainServices>
<endpoints>
<add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding" maxReceivedMessageSize="20000" maxBufferSize="20000">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
<readerQuotas maxArrayLength="20000" maxStringContentLength="20000" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="PictureService">
<endpoint address="https://MyServer/AdvisorDev/PictureService.svc"
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="PictureService.IPictureService"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IPictureService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://MyServer/AdvisorDev/PictureService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPictureService"
contract="PictureService.IPictureService" name="BasicHttpBinding_IPictureService" />
</client>
</system.serviceModel>
</configuration>
Create client:
PictureService.PictureServiceClient client = new PictureService.PictureServiceClient();
I am running this on my Dev machine using VS 2012 and using IIS as my web server. IIS is using a self-signed certificate. When my site first loads I do get the "There is a problem with this website's security certificate" error, click continue, and the rest of the application runs fine again including the Domain Service calls which use a dynamically created proxy. I create my proxy for this failing WCF service using "Add Service Reference"
One of my sources for SSL is this:
http://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx
This is the service I implemented:
http://www.silverlightshow.net/items/Uploading-and-downloading-images-from-WCF-in-Silverlight.aspx
I appreciate all advice on this, thank you.
It turns out this error was caused by an incorrect namespace in the Service name and contract attributes in the web.config for this service.
Just in case anyone else is having this issue as well, I was receiving the same error. The fix turned out to be removing inheritance from three of my classes.
My WCF service was returning a List<MyObject> and three classes inherited from the "MyObject" class. This error was thrown when one of the inheriting classes was included in the list.
Ex:
public class MyObject
public class MyObjectTwo : MyObject
...
List<MyObject> returnList;
MyObjectTwo addingThisBreaksTheService = new MyObjectTwo();
returnList.Add(addingThisBreaksTheService);
return returnList; // Exception thrown after this statement

How do I add a binding and endpoint that utilizes SSL for a WCF Workflow Service?

I have a need to secure my WCF service using SSL. The problem I'm running into is that this is a WCF Workflow service, and I can't seem to override the default bindings that it sets up behind the scenes.
There must be something that I'm missing in the configuration file, as whatever I do, the binding always comes back as: BasicHttpBinding_IService at address : http://myurl.com/biz/MyService.xamlx
It should be: https://myurl.com/biz/MyService.xamlx.
These are the bindings and endpoint sections:
<bindings>
<basicHttpBinding>
<binding name="basicBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyNamespace.MyService">
<endpoint address="https://myurl.com/biz/MyService.xamlx"
binding="basicHttpBinding"
bindingConfiguration="basicBinding"
contract="IService" />
</service>
</services>
Thanks for any help!
A few things to try:
change the binding to wsHttpBinding and that will force SSL.
change clientCredentialType to Certificate.
use this example and set the httpsGetEnabled to true:
http://blog.adnanmasood.com/2008/07/16/https-with-basichttpbinding-note-to-self/

WCF JSON returns XML data!

I'm building a WCF REST Web service which should output JSON, but I'm getting XML.
I'm using ResponseFormat = WebMessageFormat.Json
Please help I search everywhere and I couldn't find the solution.
Note: I even tried the suggestion from here
config file
<services>
<service name="TestService">
<endpoint address=""
behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding"
bindingConfiguration="webBinding"
contract="TestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
Some things you need to check:
The "name" attribute of your <service> element in web.config needs to match the fully-qualified name of the service class - if TestService is on namespace MyNamespace, then the service must be declared as <service name="MyNamespace.TestService"> - in other words, it must match the name you have in the '.svc' file for your service
Your endpoint declaration doesn't specify a behaviorConfiguration attribute; for WCF web endpoints, you need both to have the webHttpBinding and the a reference to a behavior which declares (in your case) <webHttp />
Another option is to use the WebServiceHostFactory in the .svc file: <% #ServiceHost Service="MyNamespace.TestService" Factory="System.ServiceModel.Activation.WebServiceHostFactory" Language="C#" debug="true" %>. With this you don't need to have the service defined in config.
I had a similar issue because I had a tag like this;
<behavior name="jsonBehavior">
<enableWebScript/>
<webHttp helpEnabled="true"/>
</behavior>
after I remove
<webHttp helpEnabled="true"/>
it is fixed. Maybe it is a bug. I am not sure.

WCF Error: Stream Security is required at http://www.w3.org/2005/08/addressing/anonymous, but no security context was negotiated

We have a windows service that we are trying to use as WCF host for a WPF application. It works fine in development but when we have tried to move to our production environment we have had nothing but problems. From reading posts from others, we figured out how to turn on WCF logging and this was a big help. It turned out that our security bindings on the service and the client did not match. We set them both to use windows security but still no luck now we are trying to set the security mode to 'None' but it still is not working. Here is the bindings section of our service config file:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcp">
<security mode='None'>
</security>
</binding>
</netTcpBinding >
</bindings>
<services>
<service name="CompanyService">
<endpoint
address= "our.url.com/CompanyService"
binding="netTcpBinding"
contract="CompanyServices.ICompanyService" />
</service>
</services>
</system.serviceModel>
Here is the serviceModel section of our client app config:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Config" >
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="our.url.com/CompanyService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Config" contract="CompanyServiceProxy.ICompanyService" name="NetTcpBinding_ICompanyService" />
</client>
</system.serviceModel>
If I need to supply additional infor please tell me what I need to supply.
Thanks
Standard net.tcp binding uses Windows credentials by default, and those really require client and service to be in the same Windows domain. Is this the case here??
OK, sorry, you mentioned security=None (your listings weren't properly formatted so I only saw a fraction of the actual config).
I guess your problem really lies in the addresses used:
address= "our.url.com/CompanyService"
When using net.tcp binding, you have to specify that before the address, so change this on both the client and the server to:
address= "net.tcp://our.url.com/CompanyService"
Also, what I don't quite understand is your title: it mentions "streaming" - have you specified streaming mode anywhere? In your config or your service contracts?
Marc