My application is self-hosting several wcf services.
This creates quite a mess in the application configuration file and quite difficult to maintain.
I would like to find a way to separate those configurations, so that each wcf services will have it's own configuration file.
Thank you
Edit:
I've found a way to specify a Client's config file, tried it, it works.
Now I just need to find how to do it for the self-host service, anyone?
I've found the answer.
This post includes the entire solution both on client and host side.
Thanks for those who answered.
Related
I build a WCF Windows Service and I want connect to it via Internet.
So I was looking for a suitable binding. I decided to use wsDualHttpBinding.
It is working so far if I use securityMode=None in my xml and ProtectionLevel=None in my ServiceContract.
Now I have the problem that I cannot secure the connection between my Service and my Client, because I don´t want anybody to see any details during my Login process.
When I use Message security and ProtectionLevel=EncryptAndSign I cannot access my Service.
Does anybody know where the problem is?
Thanks a lot in advance.
Finally done,
after days of researches I found a suitable solution for my problem.
I decided to use a certificate mechanism. Now I am creating a certificate and I can use message security.
Yes, it was quite an overhead, but it works fine.
I have searched over internet but did not get any specific answer or i say a satisfied answer that how can we make DLL of a WCF Service which is having webHttpBinding in its web.Config file.
I have a WCF Service which i want to deploy on client's server but i dont want them to see my code as if i host this service on their server they will able to see my code and i don't want that.
This Service responses in JSON Format which can be access only through URL.
so how to create a dll of this service and then host this on Server.
1) A DLL does not have a web.config or any other .config.
2) Deploying a Service as a DLL does not prevent anyone from seeing the (disassembled) code.
3) You may be able to configure your service in code, but only when it's self-hosting. Which would usually be as an EXE, a DLL needs something else to host it.
I have written a WCF service that uploads a file to the server. It is configured to stream the file, because they may be fairly large. I set transferMode = Streamed in my web.config and set various config size settings to fairly large-ish sizes.
This work fine for my test client. I had to set the client configurations manually to have transferMode= Streamed -- by default when I included the service reference it had set it to Buffered.
But the guy who is consuming my service is complaining about having to do that manual step. He keeps telling me something is wrong with my service and I need to fix it. I don't see anything that I can "do" about the settings not propagating to the client. And it work fine if he uses the config settings I sent him.
Is there something I should be doing? And if not is there some kind of proof I can offer this person to convince him my service is not broken? Anyone have a link to an article explaining this?
If the guy's platform, who is consuming your service, is .Net, then you can create client library with correct configuration, which consumes your service and give him to use it.
There are well known article WCF the Manual Way… the Right Way
I am trying to build a service mechanism which should be add-on based and communicating through a publish subscribe system. It must be based on WCF services.
What I have right now is a concept which I can't get to work so I decided to ask you because maybe I am going at this the wrong way (I only just started using WCF).
What I want to achieve is making a single core service with session persistency which can be extended by linking an unknown number of add-on services. I want to set up the publish subscribe system at runtime, not at buildtime, so the core-service should be able to detect what add-on services are available (using the web.config?) and then bind them to the message bus.
From the front end (ASP classic) it must be possible to access any .svc file but, maintaining session, each .svc file must be connected to the message bus.
All is hosted in a single IIS active directory.
Can you give me some hints as to where to look?
I am especially interesed in:
WCF dynamic discovery
WCF to WCF communication on the same host (in the same active directory even)
Thanks in advance, hope you can help!
Update
Thanks for your answers, I'll read up at the links you send me. I'll post my final concept solution here in due time for future reference.
My 2 cents about Publish subscribe mechanism using WCF - WCF is not inherently built for pub/sub mechanism. It is built for Request/Response model of communication. Have a look at the NService Bus for pub/sub here
Talking about Add on services on top of core service, I am not able to get What you want exactly ? Is it the Routing service which you want ? WCF 4 now provides routing service For more information look here The link also talks in detail about the discovery mechanism in WCF 4.
Also have a look the Agatha framework which also have single WCF service and no. of request handlers where in the framework will decide which request handler to call based on each request.
Search for Agatha - Davy brion for more information
I was having a similar problem since I have one common WCF service but the implementation depends on the user's role so it was kind of difficult to do that at runtime.
I found this tutorial on the matter which runs great for my propouses: http://blog.micic.ch/net/dynamic-iis-hosted-wcf-service
I have tested in my env and is very powerful technique. Hope that helps you as well. Cheers.
Anyone have a pointer to a C# configuration class that a .NET service can use to do configurations via an admin socket or other control port? I'd rather do this than a filewatcher on the app.config file.
We have some long running C#/.NET services (24h X 6.5 days/week) that may need to be re-configured on the fly. I'm looking for a good way to push out config changes to a .NET service
Any pointers appreciated.
Craig
How about exposing a WCF service for configuration purposes? That way you can get a nicely typed API for configuration of the service.
To expand on Manga's answer;
I'd recommend hosting a WCF endpoint on the same IIS box hosting your long running C#/.NET services. This endpoint run on an arbitrary port.
Its responsiblity would simply be to change the appconfig(s) of your running service(s). You could specify a config type decorated with DataContract to allow for a nice configuration API exposed to the client responsible for pushing the config changes.
I'm not experienced with WCF, but I've typically solved this problem by rolling my own API via RPC. Expose some methods to add/remove/update certain configuration items, throw some sort of UI on top of it, and you can update your service on the fly.