4
votes

My WebApp.Start method throws a System.IO.FileLoadException when other exe's are in the same folder. I have no clue why this is happening and its driving me nuts. Any help is appreciated.

//Calling webapp.start
string url = "http://*:8080/";
SignalRServer = WebApp.Start(url);


//My Owin Startup Class
class Startup
{
    public void Configuration(IAppBuilder app)
    {            
        // Branch the pipeline here for requests that start with "/signalr"
        app.Map("/signalr", map =>
        {               
            map.UseCors(CorsOptions.AllowAll);
            var hubConfiguration = new HubConfiguration
            {                    
                EnableJSONP = false,                   
                EnableDetailedErrors = true,
                EnableJavaScriptProxies = true
            };                              
            map.RunSignalR(hubConfiguration);
        });
    }
}

This was working fine until I threw the service into testing for a production rollout and now it gives the following error.

System.IO.FileLoadException: Could not load file or assembly 'AutoServiceController, Version=1.0.5270.19403, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019) File name: 'AutoServiceController, Version=1.0.5270.19403, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Owin.Loader.DefaultLoader.AssemblyDirScanner.d__1e.MoveNext() at Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList1 errors, Boolean& conflict) at Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList1 errors) at Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList1 errorDetails) at Owin.Loader.DefaultLoader.Load(String startupName, IList1 errorDetails) at Microsoft.Owin.Hosting.Loader.AppLoader.Load(String appName, IList`1 errors) at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context) at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context) at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions options) at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options) at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options) at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options) at Microsoft.Owin.Hosting.WebApp.Start(String url) at PvValuationController.PvValuationController.OnStart(String[] args) in c:\Users\ahardy\Documents\Visual Studio 2013\Projects\PvValuationController\PvValuationController\PvValuationController.cs:line 156

2
What does "threw the service into testing for a production rollout" involve?timothyclifford
The service was isolated in its project debug folder prior to this. Now its in a folder with a bunch of other services as per the way we have things setup here. I took the exe it complained about and copied it over to the debug folder and same thing occurs. Not sure why this call is "searching" for other exes. Very puzzled at the moment.Hardycore
So far i'm just trying different ways of calling webapp.start. Wondering if the WebApp.Start(StartOptions, Action<IAppBuilder>) will make a difference. Not sure what IAppBuilder is...Hardycore
So you're trying to run it alongside (in same bin) another application you've developed?timothyclifford
Yes exactly, the bin folder contains multiple other services that myself and others have developed. Multiple of which trigger this error. I tried removing the "AutoServiceController.exe" from the folder and it complained about another exe.Hardycore

2 Answers

5
votes

I recently had the same problem. For the people from the future:

You just need to specify your "Startup" class. This would solve the problem:

string url = "http://*:8080/";
SignalRServer = WebApp.Start<Startup>(url);
3
votes

This seems to have fixed the issue, though I can't tell you why.... If anyone out there can explain why this fixes the issue please let me know!

The startup class above is no longer called. Replaced the WebApp.Start(url) call with this.

            string url = "http://*:8080/";
            StartOptions options = new StartOptions();
            options.Urls.Add(url);
            SignalRServer = WebApp.Start(options, builder =>
            {
                builder.UseCors(CorsOptions.AllowAll);
                builder.MapSignalR("/signalr", new HubConfiguration
                {
                    // You can enable JSONP by uncommenting line below.
                    // JSONP requests are insecure but some older browsers (and some
                    // versions of IE) require JSONP to work cross domain
                    EnableJSONP = false,

                    // Turns on sending detailed information to clients when errors occur, disable for production
                    EnableDetailedErrors = true,
                    EnableJavaScriptProxies = true
                });
                builder.RunSignalR();
            });