Missing method errors when running ASP.NET app with xsp on linux

耗尽温柔 提交于 2019-11-29 02:05:41

The upstream bug report regarding this issue is located here.

A suggested workaround until the bug is fixed and the method implemented is to use Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule instead of HttpApplication.RegisterModule.

The issue here describes a workaround, which would be to change HttpApplication.RegisterModule to Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule in PreApplicationStart.cs in OWIN (the previous master already had the relevant IFDEF for NET 4.0, but it was reverted for some reason) or to include the DLL they specify or register the module manually in the web.config .

The alternative that doesn't require any code change to OWIN is to implement the missing method in Mono and fix the bug and then backport the fix to your Mono version.

This is not really a full answer but perhaps what I did may help someone get a little further.

After filling in some unrelated voids on the dev branch of Mono (which at the time was v3.99) like AppendTrailingBackslash(), GetBufferlessInputStream() and a few other functions, I was able to get an MVC5 app to come up and function OK on Ubuntu using XSP4.

I then tried to use OWIN and the mono-built version of SignalR.

I did what Appleman1234 suggested above, implement RegisterModule() in HttpApplication.cs to do what Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule() does. This does seem to work and injects the module string into the system.web/httpModules section without error.

This combined with manually specifying the OwinHttpHandler in my system.web:

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <customErrors mode="Off" />

    <httpHandlers>
      <add verb="*" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb" />
    </httpHandlers>

</system.web>

and calling the default MapSignalR() in my Startup Configuration():

var appBuilder = app.MapSignalR();

and after hacking up some of the SignalR code (I was getting some ReadOnlyException on a NameValueCollection as it tried to remove the Accept-Encoding from the request headers... I figured I'd get to that later), I think I got it to initialize all the way to the point where I could at least browse to /signalr and get some meaningful errors back (missing connectionId, unknown protocol, etc). I didn't get to actually testing the SignalR functionality, but I am about to do so by using a separate client program.

I am hosting this using xsp4/mono 4.5.

However, in doing so I think I clobbered the rest of the handlers/pipeline because I cannot really browse to anything else in the website (stylesheets, scripts, etc), as I get a 404

Also note that:

(1) HttpRuntime.UsingIntegratedPipeline returns false in the context of XSP4.

(2) I had to comment out the exception in HttpApplication.cs/AsyncInvoker::Invoke(), which originally threw this exception:

throw new Exception("This is just a dummy");

Given this, is there simply not yet enough Async and other support in Mono to get OWIN/SignalR to work? I am thinking that since UsingIntegratedPipeline returns false that it's a no-go for XSP4?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!