开发者

WCF - Tips for creating a solid WCF application

开发者 https://www.devze.com 2023-01-26 18:19 出处:网络
I\'ve very new at WCF, and I\'m creating a prototype application to learn, which might turn into a commercial application. I understand the very basics of WCF, and I have my application WCF functional

I've very new at WCF, and I'm creating a prototype application to learn, which might turn into a commercial application. I understand the very basics of WCF, and I have my application WCF functional, at a basic level.

开发者_开发知识库

What are some tips experienced WCF users can give regarding pitfalls and steps I can take to make the app rock solid, at least regarding the WCF layer?


Couple of points to ponder:

  • make sure to implement rock-solid exception handling on your server side - implement the IErrorHandler interface on each service, define proper fault contracts

  • make sure to enable WCF tracing on the server side - those message logs are eminently useful when diagnosing problems!

  • make sure to think about versioning - make sure to use namespaces for both your service contracts and data contracts that will allow you to distinguish later version from the older ones (by means of the contract namespace)

  • think hard about your production hosting - IIS seems like a logical choice, but it's typically plagued by too many issues and problems that you don't have if you self-host. It's a bit more work yourself to create all those hosts - but it pays off with increased stability and better control on your side


  • Use security for your web service, particularly those bindings that support digital certificates.
  • Ensure your web service is interoperable with other web service frameworks, so that potential clients do not necessary need to be created using .NET and WCF.
  • Allow for endpoints (methods) to be retired in case they become obsolete. This allows clients of your web service to be informed of these retired endpoints so that they can be updated accordingly. Your retired endpoint could inform callers of what endpoint they should be using instead.


i am new to WCF but i learn this recently and thought to share with you.

if you are hosting your services on IIS then its best practice to make this a new account that you can control the direct privileges too, since NT AUTHORITY\NETWORK SERVICE uses the default and can have a bit higher level of permissions. You can change this under the Application Pool in IIS that your website hosting WCF is running as.

my2cents

0

精彩评论

暂无评论...
验证码 换一张
取 消