SignalR WebApp.Start (url) doesn't like other exes in folder?
My WebApp.Start method throws System.IO.FileLoadException when other exes are in the same folder. I have no idea why this is happening and it drives me crazy. 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 worked fine until I dropped the service into production testing 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 using patches (IAT with more than two sections or TLS section.) (Exception from HRESULT: 0x80131019) Filename: 'AutoServiceController, Version = 1.0.5270.19403, Culture = neutral, PublicKeyToken = null' --- > System.IO.FileLoadException: Attempt to load an unverifiable executable using patches (IAT with more than two sections or TLS section.) (Exception from HRESULT: 0x80131019) at System.Reflection.RuntimeAssembly._nLoad (Assembly StringName fileName, codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & stackMark,IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) in System.Reflection.RuntimeAssembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) in System.Reflection.RuntimeAssembly.InternalLoadAssemblyName (AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for SystemIntrospection, Boolean for SystemIntrospection, Boolean for SystemIntrospection) DefaultLoader.AssemblyDirScanner.d__1e.MoveNext () in Owin.Loader.DefaultLoader.SearchForStartupAttribute (String friendlyName, IList
1 errors, Boolean& conflict) at Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList
1 error) in Owin.Loader.DefaultLoader.LoadImplementation (String startupName, IList1 errorDetails) at Owin.Loader.DefaultLoader.Load(String startupName, IList
1 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) at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start (StartOptions) at Microsoft.Owin.Hosting.Starter.HostingStarter.Start (StartOptions) at Microsoft.Owin.Hosting.WebApp.StartImplementation (Service IServiceProvider, StartOptions options) at Microsoft.Owin.Hosting.WebApp.Start (StartOptions options) at Microsoft.Owin.Hosting.WebApp.Start (String url) at PvValuationController.PvValuationController.OnStart (String [] args) at c: \ Users \ ahardy \ Documents \ Visual Studio 2013 \ Projects \ PvValuationController \ PvValuationController \ PvValuationController.cs: line 156
source to share
This seems to fix the problem, although I can't tell you why .... If anyone out there can explain why this fixes the problem, please let me know!
The startup class is not named above. Replaced the call to WebApp.Start (url) 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();
});
source to share