locked
WCF service strange issue RRS feed

  • Question

  • User794480159 posted

    I have an existing wcf service. In the Wcf service, i modified the signature of a method to accept two more parameters of type string. Based on these two new parameters, in the service method, i was executing a stored procedure which was inserting some data into database.

    After that i updated the proxy and modified the web application to send two new parameter value as per the new signature of the service method. This worked well as expected till qa environment.

    However, during deployment to the staging , somehow we missed the deployment of services and just deployed the web application.

    During Sanity checks, we checked the web application and found it working without any error but later we discovered that the sproc was not being called and no data was being inserted into database.

    After hours of struggling noticed that the service is not updated on server.

    The strange thing is that i was expecting WCF service to throw error when the method signature was different in the service and proxy. However it was just ignoring the new parameters and still executing the method with the rest of the parameters.

    Please somebody explain me this behavior.

    Thursday, June 6, 2013 4:48 AM

Answers

  • User-837620913 posted

    WCF supports "Lax versioning." Definition is:

    WCF, ASP.NET Web Services, and many other Web service stacks support lax versioning: that is, they do not throw exceptions for new unknown data members in received data.

    See more in this detailed article on Service Versioning: http://msdn.microsoft.com/en-us/library/ms731060.aspx

    I would change the XML namespace on your WCF DataContract to support strict versioning. Then you would know if the web application was calling a different method than the service was expecting.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 6, 2013 5:39 AM

All replies

  • User-837620913 posted

    WCF supports "Lax versioning." Definition is:

    WCF, ASP.NET Web Services, and many other Web service stacks support lax versioning: that is, they do not throw exceptions for new unknown data members in received data.

    See more in this detailed article on Service Versioning: http://msdn.microsoft.com/en-us/library/ms731060.aspx

    I would change the XML namespace on your WCF DataContract to support strict versioning. Then you would know if the web application was calling a different method than the service was expecting.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 6, 2013 5:39 AM
  • User794480159 posted

    Hi,

    Thanks for your reply.

    I do not have any datacontract for method, i am simply passing primitive types like integer and string in the wcf operation contract method.

    Does it also applies to method parameters.

    e.g in the service i have something like below:

    public void SomeMethod(int a, int b)
    {
    
    }

    On the proxy side, i have the below signature:

    public void SomeMethod(int a, int b, string c, string d);
    

    Now i am not getting any exception or error. Rather my service call is being successfully executed.

    Does the WCF service also ignores the unknown parameters for the method?

    Friday, June 7, 2013 1:59 AM