The WebActivator Start method doesn't handle unmanaged DLLs in the bin folder. As you see in the code file: https://bitbucket.org/dfowler/webactivator/src/4c558d93cf3a/WebActivator/PreApplicationStartCode.cs
public static void Start() {
lock (initLock) {
if (!hasInited) {
// Go through all the bin assemblies
foreach (var assemblyFile in GetAssemblyFiles()) {
var assembly = Assembly.LoadFrom(assemblyFile);
// Go through all the PreApplicationStartMethodAttribute attributes
// Note that this is *our* attribute, not the System.Web namesake
foreach (PreApplicationStartMethodAttribute preStartAttrib in assembly.GetCustomAttributes(
typeof(PreApplicationStartMethodAttribute),
inherit: false)) {
// If it asks to be called after global.asax App_Start, keep track of the method. Otherwise call it now
if (preStartAttrib.CallAfterGlobalAppStart && HostingEnvironment.IsHosted) {
attribsToCallAfterStart.Add(preStartAttrib);
}
else {
// Invoke the method that the attribute points to
preStartAttrib.InvokeMethod();
}
}
}
The Start() method loads all DLLs as assemblies to probe for its PreApplicationStartMethodAttribute. That fails for an unmanaged DLL because there is no assembly manifest.
It looks you are using a branch (dfolwler?) or a outdated version of WebActivator because the current version can handle this by ignoring all exceptions on assembly load.
private static IEnumerable<Assembly> Assemblies
{
get
{
if (_assemblies == null)
{
// Cache the list of relevant assemblies, since we need it for both Pre and Post
_assemblies = new List<Assembly>();
foreach (var assemblyFile in GetAssemblyFiles())
{
try
{
// Ignore assemblies we can't load. They could be native, etc...
_assemblies.Add(Assembly.LoadFrom(assemblyFile));
}
catch
{
}
}
}
return _assemblies;
}
}
Update WebActivator to the most recent version.