Converting ASMX to WCF Web Service

前端 未结 2 370
南旧
南旧 2021-02-02 18:31

I need to upgrade our web services to use WCF instead of ASMX. If the signatures of the web services stays the same, will existing clients that already call the ASMX service ha

相关标签:
2条回答
  • 2021-02-02 18:54

    Option 1 :

    1. Using the current ASMX's WSDL, generate the client using svcutil.exe

    2. Grab the generated interface and create a WCF service based on this interface

      Output : One new WCF endpoint configured with basicHttpBinding. Clients need to update the URL at which they're sending the messages.

    Option 2 :

    1. Refactor your ASMX code. Move all the logic into a separate DLL.

    2. Create a WCF service and use the logic in the refactored DLL.

      Output : 2 endpoints, one for ASMX and another one for WCF

    0 讨论(0)
  • 2021-02-02 18:56

    If you use the BasicHttpBinding for your new WCF service, and implement the same methods with the same message structure, existing callers should be able to call into this new WCF service without any change on their part.

    There's also an AspNetCompatibilityRequirements attribute in order to get around some potential compatibility issue - see the MSDN documentation on it.

    Marc

    0 讨论(0)
提交回复
热议问题