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

前端 未结 2 683
無奈伤痛
無奈伤痛 2020-12-16 20:45

I have ASP.NET with MVC and Razor markup website and I want to run it on my Linux VPS.

I have mono 3.2.8 and xsp4 3.0.0.0 version, both from Ubuntu repository (insta

相关标签:
2条回答
  • 2020-12-16 21:11

    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.

    0 讨论(0)
  • 2020-12-16 21:26

    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?

    0 讨论(0)
提交回复
热议问题