ATL_DEV
ATL_DEV

Reputation: 9591

Wrong module specified can't find ServiceStackHttpHandlerFactory

I am getting a "Wrong Module Specified" red squiggly in my web.config for the following lines:

<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null" verb="*"/>

FYI, I made sure to not select the Client Profile of version 3.5 of .NET framework as suggested by similar posts.

When I select Resharper's offer to "Fix the module qualification" I still get the error indication in my web.config.

I am following the sample application as provided in the ServiceStack website. I installed the latest stable release of ServiceStack, here's my package.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ServiceStack" version="3.9.38" targetFramework="net35" />
  <package id="ServiceStack.Common" version="3.9.38" targetFramework="net35" />
  <package id="ServiceStack.OrmLite.SqlServer" version="3.9.39" targetFramework="net35" />
  <package id="ServiceStack.Redis" version="3.9.38" targetFramework="net35" />
  <package id="ServiceStack.Text" version="3.9.38" targetFramework="net35" />
</packages>

When I run the application, I am greeted with this friendly message:

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: Could not load type 'ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory' from assembly 'ServiceStack, Version=3.9.38.0, Culture=neutral, PublicKeyToken=null'.

Upvotes: 1

Views: 1672

Answers (2)

David Dombrowsky
David Dombrowsky

Reputation: 1705

This comes up in searches for "could not find ServiceStackHttpHandlerFactory." In my case, the example used in Pluralsight and other places is to add the default handler of ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, which is for ServiceStack 3.9. Upgrading to ServiceStack 4.5.0, the factory is ServiceStack.HttpHandlerFactory. e.g.:

<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />

Upvotes: 3

mythz
mythz

Reputation: 143339

The ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory type is inside the main ServiceStack.dll. If it can't find it than it's not referenced properly which is likely due to either trying to add it to the wrong Profile (e.g. Client Profile) or it's not properly referenced in the Host project where your Web.config is.

Upvotes: 1

Related Questions