Software & Finance





Visual Studio.NET - WCF Specifying relative address in ServiceActivations





 

When you specify the relative address in Service Activation, remember to include .svc extension.

 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">

      <serviceActivations>

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

      </serviceActivations>

     

    </serviceHostingEnvironment>

 

When you have serviceActivations configured with relative address without the .SVC extension as given above then you will get the following error message.

 

The registered relativeAddress 'TestService' under section 'system.serviceModel/serviceHostingEnvironment/serviceActivations' in configuration file does not have an extension.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.ConfigurationErrorsException: The registered relativeAddress 'TestService' under section 'system.serviceModel/serviceHostingEnvironment/serviceActivations' in configuration file does not have an extension.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

 
[ConfigurationErrorsException: The registered relativeAddress 'TestService' under section 'system.serviceModel/serviceHostingEnvironment/serviceActivations' in configuration file does not have an extension. ]
   System.ServiceModel.HostingManager.NormalizedRelativeAddress(String relativeAddress) +197
   System.ServiceModel.HostingManager.LoadConfigParameters() +757
   System.ServiceModel.HostingManager..ctor() +133
   System.ServiceModel.ServiceHostingEnvironment.EnsureInitialized() +191
   System.ServiceModel.ServiceHostingEnvironment.OnEnsureInitialized(Object state) +4
   System.Security.SecurityContext.runTryCode(Object userData) +124
   System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
   System.Security.SecurityContext.RunInternal(SecurityContext securityContext, ContextCallback callBack, Object state) +214
   System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) +164
   System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state) +300434
   System.ServiceModel.ServiceHostingEnvironment.SafeEnsureInitialized() +65
   System.ServiceModel.Activation.ServiceHttpModule.BeginProcessRequest(Object sender, EventArgs e, AsyncCallback cb, Object extraData) +67
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +96
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184