I have a .NET project that I have inherited, in which I'm having issues getting a service to return properly when running on Windows Server IIS.
The ExceptionType is System.NullReferenceException
The Stacktrace is at Integra.HLX.SB.Web.WS_Reps..ctor() at CreateIntegra.HLX.SB.Web.WS_Reps() at System.ServiceModel.InstanceContext.GetServiceInstance(Message message) at System.ServiceModel.Dispatcher.InstanceBehavior.EnsureServiceInstance(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
This error gets thrown when I attempt to POST to the service's endpoint. I'm assuming I'm missing something within the web.config to allow this to work on IIS from a Windows Server, or maybe missing a feature setting within IIS on Windows Server.
Here is the relevant web.config settings...
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="binding1">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="Integra.HLX.SB.Web.WS_RepsAspNetAjaxBehavior">
<enableWebScript />
</behavior>
<behavior name="Integra.HLX.SB.Web.WS_ClientContactsAspNetAjaxBehavior">
<enableWebScript />
</behavior>
<behavior name="Integra.HLX.SB.Web.WS_ContactUniverseNameAddressesAspNetAjaxBehavior">
<enableWebScript />
</behavior>
<behavior name="Integra.HLX.SB.Web.WS_UsersAspNetAjaxBehavior">
<enableWebScript />
</behavior>
<behavior name="jsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="RESTbehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Integra.HLX.SB.Web.WS_Reps">
<endpoint address="" behaviorConfiguration="Integra.HLX.SB.Web.WS_RepsAspNetAjaxBehavior" bindingConfiguration="binding1" binding="webHttpBinding" contract="Integra.HLX.SB.Web.WS_Reps" />
</service>
<service name="Integra.HLX.SB.Web.WS_ClientContacts">
<endpoint address="" behaviorConfiguration="Integra.HLX.SB.Web.WS_ClientContactsAspNetAjaxBehavior" bindingConfiguration="binding1" binding="webHttpBinding" contract="Integra.HLX.SB.Web.WS_ClientContacts" />
</service>
<service name="Integra.HLX.SB.Web.WS_ContactUniverseNameAddresses">
<endpoint address="" behaviorConfiguration="Integra.HLX.SB.Web.WS_ContactUniverseNameAddressesAspNetAjaxBehavior" bindingConfiguration="binding1" binding="webHttpBinding" contract="Integra.HLX.SB.Web.WS_ContactUniverseNameAddresses" />
</service>
<service name="Integra.HLX.SB.Web.WS_Users">
<endpoint address="" behaviorConfiguration="Integra.HLX.SB.Web.WS_UsersAspNetAjaxBehavior" bindingConfiguration="binding1" binding="webHttpBinding" contract="Integra.HLX.SB.Web.WS_Users" />
</service>
<service name="Integra.HLX.SB.Web.WS_SpeakerDataFeed" behaviorConfiguration="RESTbehavior">
<endpoint address="" bindingConfiguration="binding1" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="Integra.HLX.SB.Web.IWS_SpeakerDataFeed" />
</service>
<service name="Integra.HLX.SB.Web.WS_DashboardDataFeed" behaviorConfiguration="RESTbehavior">
<endpoint address="" bindingConfiguration="binding1" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="Integra.HLX.SB.Web.IWS_DashboardDataFeed" />
</service>
</services>
</system.serviceModel>
Any help would be appreciated. Thanks!
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />I found out more information by checking the Windows Event Viewer logs and found this key bit of informationThe service cannot be activated because it requires ASP.NET compatibility.which pointed me in the right direction. Just wish the original exception had more relevant information.