What is real example of wcf self hosting in practice and when should I use it? please bring a real example.
Thanks a lot
Related
Is it even possible more or less natively consume WCF service from Go application?
I can imagine it should be possible to execute SOAP calls in Go, but WCF is a bit more than that only, for example authorization will probably be a problem also...
Have anyone at least approached this area, or maybe someone can give useful me advice in this "wheel reinvention task"?
Thank you in advance for all your input, ideas and suggestions.
I think you should expose a RESTful Service. I myself have the problem with exposing a WCF Service too many clients using PHP, Go, Ruby and all kind of languages. We never ever got it right, to automatically generate a proxy.
The maybe simplest way is to use WCF, like described in this example:
https://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-
By-Step-Guide
But I recommend to switch to ASP.NET Core (Migration is not that hard) or if you have the budget I would consider https://servicestack.net/
It may be well beyond the wait time for this. However, here is something really interesting that could help. The situation the authors found themselves is relevant even today in some organizations.
https://github.com/khoad/msbingo
Here's the motivation provided by the authors:
Application/soap+msbin1 encoding was a blocking issue for modernizing services from WCF to platform-agnostic technologies such as Go. We needed to be able to make calls to dependency services that spoke msbin1 and were not going to be updated or even reconfigured, but we did not want to introduce unnecessary complexity such as workarounds like .NET-based WCF request translator proxies or deploying Mono with our service instances. Initially we tried the Mono deployment route, which, while it would have worked well enough, significantly complicated our deployment pipeline, thus erasing one of the major advantages of golang.
I found it a useful starting point to begin experimentation.
I am in the process of performance testing the entire system. I used SlimTune on some Winform Applications in order to identify bottlenecks and I like it, it was very simple to use and understand.
Now I want to do the same over some WCF services (all self hosted).
What Tools should I use? (free tools please)
Is there any way to use SlimTune for this?
The following thread asks the same question and has some good advice.
How to get started with WCF Performance profiling
I want to host multiple WCF services in windows service but I am unsure if hosting multiple WCF services is an expensive process? Can someone please guide?
It depends on the complexity of the service itself, but generally, they are not resource intensive.
It will also depends of the number of connected clients and requests you will get.
The rule is very simple here. You need to decompose your system requirements into the right level of granularity that minimizes the cost of implementation versus the cost of integration. Too many services and your integration costs will suffer. Too few services and your implementation costs will suffer. My personal experience is that if any service has more than 10 methods you really need to start looking into your design and the methodology you have used to design it like that. Also please note that services with too many methods do not scale that well neither.
I have a question. I would like to serve a series of services made with WCF. The client that consumes the services is also .NET with WCF. I would like to have high speed of access, fast response, transport medium to small Data Contracts (primary .net basic data types). The distribution will be over internet, I´m looking for reliability, availability and basic security.
I don´t want to use WsHttp, because my only client is based on .net and I will have almost 150 clients requesting the services.
What do you suggest to use for binding? Are there any disadvantages, risks, etc?
Thanks in advance!
Since you plan to use simple types and small data contracts, the binding you use is nearly irrelevant compared to the latency introduced by going over the Internet. So, the right answer is to use the one which is easiest to manage and the most secure.
I recommend that you host the app in IIS and use a wsHttpBinding and take all the manageability goodness that goes along with it. It will also happen to be interoperable, and while that is irrelevant today, it is just free, so why not?
And, please consider the granularity of your service. You know your customers better, but on the wide open Internet, stuff happens. Because the round trip time over the Internet is variable and impossible to control, it could take milliseconds or seconds or may not get there at all. So, you should take fewer trips with larger payloads if possible, and use all sorts of caching and async operations to make the app appear "fast".
There is a good article on choosing a binding by Juval Lowy here:
http://www.code-magazine.com/article.aspx?quickid=0605051&page=3
Generally the advice is not to use net tcp binding over the internet. Have not heard of anyone doing it. Although it may work if the ports are open all the way and no one blocks the calls.
Test it with nettcp, if it does not work you just need to change the configuration.
The most important thing is to consider your security needs. Do you just need point to point, then basichttp over ssl. Do you need end to end, then wshttp with message encryption.
According to your scenario, NetTcpBinding is the binding of choice. As you are sure that client will be WCF, no need for interoperability.
Have a look here in Programing WCF Services book.
The only thing I'm not sure about is firewalls. If you have to get trough on of theses, maybe some WS binding could be more appropriate.
What is the best practice around implementing WCF proxy pooling? What precautions should be taken in the design?
Any pointers in this direction is greatly appreciated.
If you want to go down that path, from Performance Improvement for WCF Client Proxy Creation in .NET 3.5 and Best Practices:
You need to implement the right
synchronization logic for managing the
proxies.
You need to make sure the
proxies are used equally. Sometimes,
you may want to implement a
round-robin pattern for the proxies.
You need to handle
exceptions and retries for the pool.
The pool size needs to be
limited and configurable.
You may need to be able to
create proxies even if when no proxy
is available from the pool.
Why do you want to pool proxies?
Pools usually only exist when a resource (like a database connection) is scarce, expensive to build and possibly costly to maintain.
This should not be the case with WCF proxies, really - you create them as needed, and discard them when no longer needed.
I don't see any benefit or real use in trying to pool WCF proxies - what problem or issue are you trying to solve?
OK, thanks for your reply - I do understand what you're trying to accomplish - but I'm afraid, you're pretty much on your own, since I don't think there's any bits and pieces in the .NET framework and/or the WCF subsystem to would aid in creating proxy pools.
Marc
PS: as the article that Tuzo linked to shows, maybe you can get away with just caching the channelFactory objects. Creating those is indeed quite expensive, and if you can cache those for the lifetime of the app, maybe that'll be good enough for your needs. Check it out!