WCF basichttpbinding netTcpBinding routing - wcf

I have created a WCF routing service. This service uses basicHTTPBinding as it is external facing, needs to interoperate and the client can't work with wsHttpBinding. This service receives all incoming method calls and forwards them onto another service. This other service is internal and uses netTcpBinding.
The problem is I am getting the following error:
Addressing Version 'AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)' does not support adding WS-Addressing headers.
Now, I am not entirely sure, but I am assuming this is something to do with the messages coming in as SOAP 1.1 but the netTcpBinding is using SOAP 1.2 and there is a mismatch? If so, how do I work around this? If not, any ideas what else it could be?
Thanks in advance

The answer is to explicitly copy the message into the right message version and then forward that on. You must also remember to copy the message back to the original version on the way back.

Related

Does WCF Add Service Reference require something configured on the service to generate the app config?

We have an existing wcf service, and I created a new project. I want to use it. I hit add service reference, pop in the URL, press OK, and it adds it as a service reference but there is no config generated.
I also tried svcutil.exe /language:cs /out:GeneratedProxy.cs /config:app.config [url] but no config is generated, only the proxy cs.
I'm using VS 2013 / .NET 4.0
My question is, is this a sign that the SVC itself has some missing data that is required to build the contracts, or is the problem with adding the service reference?
For the record I have tried unchecking the reuse types option which some questions on here have reported as fixing the problem.
Bonus question, do you think if I can't get this working that manually adding some generic default bindings and endpoint code to the web config will work?
First, the reason that why the Adding service reference generates nothing is that the WCF service is rest style service. By default, the proxy-based invocation of rest style WCF services is complex.
https://en.wikipedia.org/wiki/Representational_state_transfer
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model
Calling the WCF rest style service with the client proxy is uncommon. Generally, we construct an Http request by using an HTTP client library to call the service, such as HttpClient, WebClient.
How to fix "ERR_ABORTED 400 (Bad Request)" error with Jquery call to C# WCF service?
Besides, calling the WCF rest style service with the client proxy is feasible. Please refer to my previous link.
WCF: There was no endpoint listening at, that could accept the message
Feel free to let me know if there is anything I can help with.

Developing Wcf Callback service using netTcpBinding

I stuck in a problem regarding wcf Callback service.
I am trying to develop WCF Callback service using netTcpBinding, I successfully created this Callback Service using wsDualHttpBinding but when i try to achive same thing using netTcpBinding, I am always stuck in some problem.
sometimes it is "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it."
or "This protocol does not support netTcpBinding"
so anyone can show me how to configure web.config file and how to overcome this types of error..
Thank you.
Without you supplying the code and config that you are currently using it is difficult to tell what is causing this error.
Maybe take a look at Duplex Messaging and TechNet: Creating a Duplex Service.

NServiceBus and WCF

I want to achieve the following:
Expose WCF endpoint to client from which they request a long-running operation.
Map the inbound request to a NServiceBus Message.
Publish the message to the bus for processing.
Send a reply to the client acking that their request has been received and we will begin processing it.
Bus works the message through a handler.
Can you help me with some examples here please?
Thanks in advance
You can check out the WcfIntegration sample that comes with NSB to see how to expose an endpoint via WCF. To hand off the message, you can simply call Bus.Send() to another endpoint to do processing, then use the Bus.Return() that is in the sample. From there, the other endpoint can look just like the Server part of the FullDuplex sample without the Bus.Reply() logic.
Awhile ago I created some example code that is similar to this, although it used a traditional ASMX web service and not a WCF one, but that is really just an implementation detail.
Check out NServiceBus External WebService Example on GitHub.

How to use BasicHttpBinding without using sessions in WCF? Getting error about session support

I have a WinForm app which uses WCF to call a WCF service. I am trying to troubleshoot an issue and need to look at the wcf trace file without any encryption. So I have WCF endpoint set to use BasicHttpBinding and my service contract is set for SessionMode = SessionMode.NotAllowed.
However I keep getting an error "Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it".
I don't want to use sessions. Why does it think I want to use sessions?
OR how do I get the messages to go on the wire where I can see objects and their properties in clear text in the trace file?
BasicHttpBinding never uses session. There is something incorrectly configured in your code (or you didn't correctly update service reference). To see messages even if security is enabled use Message logging.

Is it possible to persist and then forward WCF messages to destination services?

The goal I'm working toward is having a WCF routing service that can receive messages from clients, persist them to some type of data store, and then process/send them to their destination WCF services.
Things to consider:
You can create a routing service by using the ClientViaBehavior (outlined here and here)
The ClientViaBehavior will not work with basicHttpBinding, so I need to use wsHttpBinding (basicHttpBinding doesn't set the "To" header on the message, found out the hard way)
The WCF Message object itself is sent to the Routing Service, where it can be persisted as a serialized string
I don't want the Routing Service to know what's in the message - consequently, the service will not have a reference to the Data Contracts involved
When the time comes to route the Message to its destination, I need to be able to create a channel between the Routing Service and the Destination Service
It is not desirable for the Routing Service to be aware of each destination service - ideally, WCF could create the proper channel dynamically based on the content/headers of the message being processed.
Is this too much to ask of WCF? (I have a feeling it might be...)
Any advice on how to accomplish something like this would be appreciated.
If you're on .NET 4 (or can move to it), WCF 4.0 has introduced a RoutingService infrastructure of its own.
Check it out, before you re-invent the wheel!
See A Developer's Introduction to Windows Communication Foundation 4 for a great general intro to the new features (including RoutingService) in WCF 4
Yes, you can make your routing service accepts any message.
This link should help you: Building a WCF Router, Part 1