SignalR WebApp.Start(url) 不喜欢文件夹中的其他 exe?
SignalR WebApp.Start(url) doesn't like other exe's in folder?
我的 WebApp.Start 方法在其他 exe 位于同一文件夹中时抛出 System.IO.FileLoadException。我不知道为什么会这样,这让我发疯。感谢任何帮助。
//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);
});
}
}
在我将该服务投入生产部署测试之前,它工作正常,但现在它出现以下错误。
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, IList
1 errors)
at 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 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
这似乎已经解决了问题,虽然我不能告诉你原因....如果有人能解释为什么这解决了问题,请告诉我!
不再调用上面的启动class。用这个替换了 WebApp.Start(url) 调用。
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();
});
我最近遇到了同样的问题。对于未来的人们:
您只需指定您的 "Startup" class。
这将解决问题:
string url = "http://*:8080/";
SignalRServer = WebApp.Start<Startup>(url);
我的 WebApp.Start 方法在其他 exe 位于同一文件夹中时抛出 System.IO.FileLoadException。我不知道为什么会这样,这让我发疯。感谢任何帮助。
//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);
});
}
}
在我将该服务投入生产部署测试之前,它工作正常,但现在它出现以下错误。
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, IList
1 errors, Boolean& conflict) at Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList
1 errors) at 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 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
这似乎已经解决了问题,虽然我不能告诉你原因....如果有人能解释为什么这解决了问题,请告诉我!
不再调用上面的启动class。用这个替换了 WebApp.Start(url) 调用。
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();
});
我最近遇到了同样的问题。对于未来的人们:
您只需指定您的 "Startup" class。 这将解决问题:
string url = "http://*:8080/";
SignalRServer = WebApp.Start<Startup>(url);