Can I create a WCF service without using attributes?
-
05-09-2019 - |
Question
The way you seem to declare WCF services is to create an interface in C# or VB, and then tag it with ServiceContractAttribute
and it's methods with OperationContractAttribute
.
The issue is, I'd like to try creating one from IronRuby or IronPython, which (to my knowledge) don't support attributes.
Is this possible?
Solution
You can just use the object model in the System.ServiceModel.Description namespace (e.g. ContractDescription) to new up the right description objects, poke them in to a service's description's endpoints, and then open the host. But this is very non-trivial.
OTHER TIPS
AFAIK you can't yet in IronRuby. It's one of those interop things that are on the back burner while language compatibility is worked on. There's still alot of discussion needed about how to do this... but it is something that those of us working on IronRuby would like to see.
Well, while I wouldn't (just preference, no need to flame me), you could use a language like Boo:
Another alternative is to just build a piece in C# to do this communication for you then call that from IronyRuby or whatever language you want to use.