Software & Finance





Visual Studio.NET - WCF Exception by specifying absolute address in place of relativeaddress in ServiceActivations





 

Here is the information on how to fix WCF Exception when specifying absolute address in place of relativeaddress in ServiceActivations

 

Parser Error Message: The value for the property 'relativeAddress' is not valid. The error is: '/TestService.svc' is an absolute address. The supported relativeAddress formats are "[subfolder/]filename" or "~/[subfolder/]filename".

 

 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">

      <serviceActivations>

        <add relativeAddress="/TestService.svc" service="Wcf_Test_Service.TestService"/>

      </serviceActivations>

     

    </serviceHostingEnvironment>

 

When you use the absolute address in place of relative address in service activations like given above, you will get the configuration error given below:

 

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The value for the property 'relativeAddress' is not valid. The error is: '/TestService.svc' is an absolute address. The supported relativeAddress formats are "[subfolder/]filename" or "~/[subfolder/]filename".  

Source Error:

 
Line 36:     <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
Line 37:       <serviceActivations>
Line 38:         <add relativeAddress="/TestService.svc" service="Wcf_Test_Service.TestService"/>
Line 39:       </serviceActivations>
Line 40:       


Source File: D:\Hosting\7299040\html\wcftestservice\web.config    Line: 38

 

 

 

To fix this error, use the relative path for .svc file like given below:

 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">

      <serviceActivations>

        <add relativeAddress="TestService.svc" service="Wcf_Test_Service.TestService"/>

      </serviceActivations>

     

    </serviceHostingEnvironment>