Could not load type

Have a ServiceStack project that is setup as a WebHost and running through IIS. Running on my Windows 10 laptop all is good, but when I deploy it to Windows Server 2012 Datacenter it throws the following error.

Server Error in ‘/’ Application.


Could not load type ‘ServiceStack.DataAnnotations.CheckConstraintAttribute’ from assembly ‘ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43’.
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.TypeLoadException: Could not load type ‘ServiceStack.DataAnnotations.CheckConstraintAttribute’ from assembly ‘ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43’.

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:

[TypeLoadException: Could not load type ‘ServiceStack.DataAnnotations.CheckConstraintAttribute’ from assembly ‘ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43’.]
ServiceStack.OrmLite.OrmLiteConfigExtensions.GetModelDefinition(Type modelType) +0
ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.CreateTable(IDbCommand dbCmd, Boolean overwrite, Type modelType) +59
ServiceStack.OrmLite.OrmLiteExecFilter.Exec(IDbConnection dbConn, Func`2 filter) +151
Ngage.AdminApp.Repositories.DbInitializer.InitializeDb(IDbConnectionFactory dbConnectionFactory, Boolean recreate) in C:\Users\Pete\Source\Repos\vNext\AdminApp.Repositories\DbInitializer.cs:194
Ngage.AdminApp.AppHost.AppHostConfiguration.ConfigureMeThis(Container container, String sqlConnectionString, Boolean recreate, String executingPath) in C:\Users\Pete\Source\Repos\vNext\AdminApp.AppHost\AppHostConfiguration.cs:71
Ngage.AdminApp.WebHost.AppHost.Configure(Container container) in C:\Users\Pete\Source\Repos\vNext\AdminApp.WebHost\AdminApp.WebHost\AppHost.cs:98
ServiceStack.ServiceStackHost.Init() +319
AdminApp.WebHost.Global.Application_Start(Object sender, EventArgs e) in C:\Users\Pete\Source\Repos\vNext\AdminApp.WebHost\AdminApp.WebHost\Global.asax.cs:10

[HttpException (0x80004005): Could not load type ‘ServiceStack.DataAnnotations.CheckConstraintAttribute’ from assembly ‘ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43’.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +534
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +175
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +424
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +360

[HttpException (0x80004005): Could not load type ‘ServiceStack.DataAnnotations.CheckConstraintAttribute’ from assembly ‘ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43’.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +730


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1590.0

This error is thrown on the first request, which runs some ORMLite setup code that is dropping and recreating a table.

Any ideas?

Thanks

The only thing different about ServiceStack.Intefaces.dll is that it’s a PCL library, there were few issues reported with running PCL libraries on some .NET environments which require installation of the KB2468871 patch.

If that doesn’t resolve the issue then see if there are any .NET Framework updates to install.