WCF change endpoint address at runtime

So your endpoint address defined in your first example is incomplete. You must also define endpoint identity as shown in client configuration. In code you can try this: EndpointIdentity spn = EndpointIdentity.CreateSpnIdentity(“host/mikev-ws”); var address = new EndpointAddress(“http://id.web/Services/EchoService.svc”, spn); var client = new EchoServiceClient(address); litResponse.Text = client.SendEcho(“Hello World”); client.Close(); Actual working final version by valamas EndpointIdentity … Read more

WCF error: The caller was not authenticated by the service

If you use basicHttpBinding, configure the endpoint security to “None” and transport clientCredintialType to “None.” <bindings> <basicHttpBinding> <binding name=”MyBasicHttpBinding”> <security mode=”None”> <transport clientCredentialType=”None” /> </security> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration=”MyServiceBehavior” name=”MyService”> <endpoint binding=”basicHttpBinding” bindingConfiguration=”MyBasicHttpBinding” name=”basicEndPoint” contract=”IMyService” /> </service> Also, make sure the directory Authentication Methods in IIS to Enable Anonymous access

Timeouts WCF Services

Client side: SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case). This timeout also applies when sending reply messages from a CallbackContract method. OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is … Read more

net.pipe vs. net.tcp vs. http Bindings

While not great for providing specific usage examples, here is a link from MSDN which lists all the features for the bindings. http://msdn.microsoft.com/en-us/library/ms730879.aspx Here is a decent flow chart that can help choosing between them as well. Source: http://bloggingabout.net/blogs/dennis/archive/2006/12/01/WCF-Binding-decision-chart.aspx Here is a good overall article I’ve used in the past. http://mkdot.net/blogs/dejan/archive/2008/03/31/wcf-binding-decision.aspx (or here in the … Read more

How to programmatically connect a client to a WCF service?

You’ll have to use the ChannelFactory class. Here’s an example: var myBinding = new BasicHttpBinding(); var myEndpoint = new EndpointAddress(“http://localhost/myservice”); using (var myChannelFactory = new ChannelFactory<IMyService>(myBinding, myEndpoint)) { IMyService client = null; try { client = myChannelFactory.CreateChannel(); client.MyServiceOperation(); ((ICommunicationObject)client).Close(); myChannelFactory.Close(); } catch { (client as ICommunicationObject)?.Abort(); } } Related resources: How to: Use the ChannelFactory

This could be due to the service endpoint binding not using the HTTP protocol

I think there is serialization problem, you can find exact error just need to add below code in service config in <configuration> section. After config update “App_tracelog.svclog” file will create, where your service exist just need to open .svclog file and find red color line on left side panel which is error and see its … Read more

What is the difference between a WCF Service Application and a WCF Service Library?

A service application includes a website host already setup for you. A service library is a library of services that a host can reference and startup. If you start with a service library (recommended) you can then choose any host you wish (a windows service, IIS/ASP.NET, or even a console application) and you’d just reference … Read more

BasicHttpBinding vs WsHttpBinding vs WebHttpBinding

You’re comparing apples to oranges here: webHttpBinding is the REST-style binding, where you basically just hit a URL and get back a truckload of XML or JSON from the web service basicHttpBinding and wsHttpBinding are two SOAP-based bindings which is quite different from REST. SOAP has the advantage of having WSDL and XSD to describe … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)