Could not find default endpoint element error - c#

I am getting below error while consuming a WCF service. I have developed a wcf service which is being consumed by a usercontrol.And user control is used as module in DNN.
But if i simply consume the wcf in web application it is working fine but consuming in DNN module is giving below error
Could not find default endpoint element that references contract 'OperationService.IOperation' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Please advise.
Client side config is below
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IOperation" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:54147/WCFService/Service.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOperation"
contract="OperationService.IOperation" name="WSHttpBinding_IOperation">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Added service config of wcf service from comment
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Operation">
<endpoint address="" binding="wsHttpBinding"
contract="IOperation">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

copy the section from the app.config to your site's web.config. you may need to change the endpoint's address attribute.

The contract name needs to be fully qualified (namespace + name) in the <endpoint> element, like this:
<endpoint address="" binding="wsHttpBinding"
contract="OperationService.IOperation">
Also, make sure that the name attribute in the <service> element matches the name attribute in the .svc file markup.

Related

WCF service in client returns 404 over https

web.config settings on the server:
<service name="ExporterWebService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="IExporterWebService"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
and client app.config is:
<client>
<endpoint
address="https://sample.coom/webservice/rwar.svc"
binding="wsHttpBinding" bindingConfiguration="basicHttpBinding"
contract="IRIBExporterWebService.IExporterWebService"
name="BasicHttpBinding_IExporterWebService"/>
</client>
<basicHttpBinding>
<binding name="BasicHttpBinding_IExporterWebService" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
I am trying to test out WCF with SSL and seem to be missing something, I have done a ton of searching and can't seem to find what I'm missing with the config, I have a basic WCF service hosted in IIS, I also have a test client web application that is calling the WCF service.
Please help!!! :-)
You are supposed to type a wrong service address on the client-side when adding service reference.
The client would not generate a service endpoint created by Wshttpbinding when consuming a service created by Basichttpbiding.
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="IExporterWebService"/>
<endpoint
address="https://sample.coom/webservice/rwar.svc"
binding="wsHttpBinding" bindingConfiguration="basicHttpBinding"
contract="IRIBExporterWebService.IExporterWebService"
name="BasicHttpBinding_IExporterWebService"/>
Besides, the server uses an empty relative endpoint address, while your client-side has a webservice prefix.
<client>
<endpoint
address="https://sample.coom/webservice/rwar.svc"
binding="wsHttpBinding" bindingConfiguration="basicHttpBinding"
contract="IRIBExporterWebService.IExporterWebService"
name="BasicHttpBinding_IExporterWebService"/>
Moreover, please trust the server certificate to establish a secure connection before making a call.
i have a mistake, we have tow webservice by tow address on server, & I forgot set config https webService new on server
thank you all friends

Custom Binding WCF with tcpTransport

I have a WCF Service hosted on a Windows Service that runs on the same network using its own credentials. Security is not important. However, speed and reliability are important.
So, I tried with a netTcpBinding binding. However, I noticed that when I reference the Service into the client. It adds to the configuration file the identity tag with the information of the account that the service is running on:
<identity>
<userPrincipalName value="account#domain" />
</identity>
I really don't want to have this in the client's configuration file, nor I want to pass it programmatically.
When I use instead a basicHttpBinding, I noticed that it does not add this tag. However, I still want to stick with net.tcp. So, my next try was to use a customBinding
So, here is where my problem is. I am not able to reference the custom binding to the client. Can someone verify my configuration? Also. Will this be enough to ignore completely the identity tag? If this is not the proper way, what would be the proper way? Thanks
<system.serviceModel>
<services>
<service name="LicenseServiceLogic.LicenseService">
<endpoint address="net.tcp://localhost:8000/LicenseService"
binding="myCustomBinding"
contract="LicenseServiceLogic.ILicenseService">
</endpoint>
</service>
</services>
<bindings>
<customBinding>
<binding name="myCustomBinding">
<compactMessageEncoding>
<binaryMessageEncoding/>
</compactMessageEncoding>
<tcpTransport listenBacklog ="100"
maxBufferPoolSize ="524288"
maxBufferSize ="2147483647"
maxReceivedMessageSize ="2147483647"/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint binding="customBinding"
bindingConfiguration="myCustomBinding"
contract="IMetadataExchange"
name="http" />
</client>
</system.serviceModel>
First, the reason that we could not reference the custom binding to the client is we should add MEX service endpoint and enable the service metadata behavior. Like below,
<system.serviceModel>
<services>
<service name="VM1.MyService" behaviorConfiguration="mybehavior">
<endpoint address="" binding="netTcpBinding" contract="VM1.IService" bindingConfiguration="mybinding">
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" ></endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:5566"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="mybinding">
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="mybehavior">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Besides, if we don’t want to add the identity tag to the client configuration, just we need to do is to set the Security Mode to NONE. As shown above.
For Mex endpoint details.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/metadata
Feel free to let me know if there is anything I can help with.

WCF Test Client EndPoint error

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

WCF Client does not consider Host Address

I have the following configuration file for WCF service. There is a host defined in the config. Still, when I print the service address from the client, it does not know about the host. The printed result is:
http://localhost:3187/Service1.svc/MyFolder
Why doesn’t it take into account the host name? What modification do we need to do for it?
Note: I am running from VS 2010 for running service and client website.
Service1Client myClientService = new Service1Client();
Response.Write(myClientService.Endpoint.Address);
Client Configuration (Autogenerated by Visual Studio)
<client>
<endpoint address="http://localhost:3187/Service1.svc/MyFolder"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="MyWCFReference.IService1" name="WSHttpBinding_IService1">
<identity>
<userPrincipalName value="U16990#ustr.com" />
</identity>
</endpoint>
</client>
The server side configuration is:
<services>
<!--MyService-->
<service name="MyWCFServiceApplication.MyService"
behaviorConfiguration="WeatherServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:80/ServiceModelSamples/FreeServiceWorld"/>
</baseAddresses>
</host>
<endpoint address="MyFolder"
binding="wsHttpBinding"
contract="MyWCFServiceApplication.IService1" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WeatherServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
When a WCF service is hosted in an ASP.NET process, through either IIS or the ASP.NET Development Server (a.k.a Cassini), the baseAddresses setting in the service's configuration file is ignored since the service will always be reachable through the URL of the SVC file.
The URL you're seeing on the client is therefore correct:
http://localhost:3187/Service1.svc/MyFolder
As you can see, the base address of the service becomes the URL of the SVC file on the web server.
You're talking about a WCF client - yet, the config you posted only contains config for a service (the server side) ... (the <services> section).
I can't see any client configuration in what you posted - there ought to be a <client> section in your config somewhere

WCF and .NET 3.5: receiving large arrays

I am struggling to understand what I am doing wrong. I have a simple interface that accepts an array. I can't make it to handle more than ~150 items - getting back 400 Bad Request. What am I doing wrong? Can anyone spot anything? I looked thru this post and it appears to be the answer but it doesn't work for me: WCF maxReceivedMessageSize not being read from config.
The service is hosted in IIS7 and uses .NET 3.5. Here is my web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyService.basicHttpBinding" maxReceivedMessageSize="5000000" maxBufferSize="5000000">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- Please set this to false when deploying -->
<serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyService.Service1Behavior" name="MyService">
<endpoint address="ws" binding="wsHttpBinding" contract="IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" bindingConfiguration="MyService.basicHttpBinding" contract="IMyService" />
</service>
</services>
</system.serviceModel>
To troubleshoot turn on tracing both on the server and on the client, then inspect the log file. The error message points more to an object not being marked as [Serializable].
See http://msdn.microsoft.com/en-us/library/ms732023.aspx for guidance.
What's the config on the receiving end? I found the serializer blew up on receipt of lots of data.

Categories

Resources