SignalR WebApp.Start(url) doesn't like other exe's in folder?

3

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

c#
.net
signalr
owin
signalr-hub
asked on Stack Overflow Aug 4, 2015 by Hardycore • edited Aug 4, 2015 by Nikolay Kostov

2 Answers

4

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);
answered on Stack Overflow Aug 23, 2016 by Gabsch
3

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();
            });
answered on Stack Overflow Aug 4, 2015 by Hardycore

User contributions licensed under CC BY-SA 3.0