Search code examples
c#asp.netwcfwebforms

Name in "namespace" in a config file, is it possible?


Is it possible to include the URL in the namespace tag inside the config file?

For example:

There is the instruction below in ".cs" and ".svc" classes.

[ServiceBehavior(Namespace = "https://xpto.xpto.com/")]


Solution

  • As far as I know, it is impossible. Changes to the configuration file take effect in the runtime environment after the compilation phase, in the runtime environment, before invoking the service, and the methods to be invoked is determined.
    The namespace of the WCF SOAP service will be used by the client to address the particular operations. Like the below screenshot.
    enter image description here
    The address that Post to is the service base address, while the practical method will be called is determined by the SOAPAction field.

    http://tempuri.org/IService/SayHello

    http://tempuri.org is the default namespace. The rest is the address of the method name.
    Feel free to let me know if there is anything I can help with.