[Mono-list] Owin authentication: Method GetBufferlessInputStream not found

Rodrigo Kumpera kumpera at gmail.com
Mon Oct 5 15:31:44 UTC 2015


This method was added to master after 4.2.0 was branches.

Would you mind trying with master or 4.3.0?

--
Rodrigo

On Sun, Oct 4, 2015 at 5:18 AM, Olli Heiskanen <
ohjelmistoarkkitehti at gmail.com> wrote:

>
> Hello experts,
>
> I was wondering if someone here could help me out with an Asp.Net Web API
> with owin authentication on a CentOS server with the latest mono release.
>
> I'm trying to get such a service working on mono on CentOS server, with
> apache and mod_mono. I'm using mono compiled from source, from git repo
> release mono-4.2.1.36.
>
> I've verified a working Asp.Net website without authentication in my
> CentOS environment, and on my Windows development environment I have a
> working example of an API with owin authentication using bearer tokens to
> authenticate.
>
> Problem is, when deployed to apache, when I send a http POST to the /token
> endpoint, the server returns a 200 OK, but without any response payload
> (which would include the bearer token the client needs to authenticate
> subsequent requests). Also, I get an exception (below) in the apache error
> log (note it originates from Microsoft.Owin.Host.SystemWeb). My server is
> CentOS, but I posted a question about this on stackoverflow and someone
> commented they have observed the same on Ubuntu as well. Nobody was able to
> answer my question there so perhaps here I'll find better expertise on this.
>
>
> System.MissingMethodException: Method
> 'HttpRequestBase.GetBufferlessInputStream' not found.
>   at Microsoft.Owin.Host.SystemWeb.CallStreams.InputStream.get_Stream ()
> <0xb0e339b8 + 0x00013> in <filename unknown>:0
>   at
> Microsoft.Owin.Host.SystemWeb.CallStreams.DelegatingStream.get_CanRead ()
> <0xb0e45eb0 + 0x00013> in <filename unknown>:0
>   at System.IO.StreamReader..ctor (System.IO.Stream stream,
> System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks,
> Int32 bufferSize, Boolean leaveOpen) <0xb0e5d790 + 0x0005f> in <filename
> unknown>:0
>   at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor
> (System.IO.Stream,System.Text.Encoding,bool,int,bool)
>   at Microsoft.Owin.OwinRequest+<ReadFormAsync>d__0.MoveNext ()
> <0xb0e33510 + 0x000f3> in <filename unknown>:0
> --- End of stack trace from previous location where exception was thrown
> ---
>   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
> <0xb0e34a68 + 0x0002b> in <filename unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
> (System.Threading.Tasks.Task task) <0xb0e346d0 + 0x000bb> in <filename
> unknown>:0
>   at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
> (System.Threading.Tasks.Task task) <0xb0e34588 + 0x0007f> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
> (System.Threading.Tasks.Task task) <0xb270df98 + 0x00033> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult ()
> <0xb270e1d0 + 0x00017> in <filename unknown>:0
>   at
> Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler+<InvokeTokenEndpointAsync>d__22.MoveNext
> () <0xb0e2f118 + 0x00463> in <filename unknown>:0
> --- End of stack trace from previous location where exception was thrown
> ---
>   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
> <0xb0e34a68 + 0x0002b> in <filename unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
> (System.Threading.Tasks.Task task) <0xb0e346d0 + 0x000bb> in <filename
> unknown>:0
>   at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
> (System.Threading.Tasks.Task task) <0xb0e34588 + 0x0007f> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
> (System.Threading.Tasks.Task task) <0xb270df98 + 0x00033> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0xb270df70
> + 0x00013> in <filename unknown>:0
>   at
> Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler+<InvokeAsync>d__0.MoveNext
> () <0xb270e790 + 0x007a7> in <filename unknown>:0
> --- End of stack trace from previous location where exception was thrown
> ---
>   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
> <0xb0e34a68 + 0x0002b> in <filename unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
> (System.Threading.Tasks.Task task) <0xb0e346d0 + 0x000bb> in <filename
> unknown>:0
>   at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
> (System.Threading.Tasks.Task task) <0xb0e34588 + 0x0007f> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
> (System.Threading.Tasks.Task task) <0xb270df98 + 0x00033> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult ()
> <0xb270f5b0 + 0x00013> in <filename unknown>:0
>   at
> Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1+<Invoke>d__0[TOptions].MoveNext
> () <0xb270b2a0 + 0x0030f> in <filename unknown>:0
> --- End of stack trace from previous location where exception was thrown
> ---
>   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
> <0xb0e34a68 + 0x0002b> in <filename unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
> (System.Threading.Tasks.Task task) <0xb0e346d0 + 0x000bb> in <filename
> unknown>:0
>   at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
> (System.Threading.Tasks.Task task) <0xb0e34588 + 0x0007f> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
> (System.Threading.Tasks.Task task) <0xb270df98 + 0x00033> in <filename
> unknown>:0
>   at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0xb270df70
> + 0x00013> in <filename unknown>:0
>   at
> Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage+<RunApp>d__5.MoveNext
> () <0xb270aa98 + 0x00173> in <filename unknown>:0
>
>
>
>
> So apparently the GetBufferlessInputStream method is not implemented in
> that namespace (I know it is implemented elsewhere). Then I tried the old
> remove-the-dll trick and the behavior changed: Now there is no exception in
> the log, but instead, when I send the http POST to the /token endpoint, the
> server returns a 500 Internal Server Error like so:
>
> System.Web.HttpException
> Method 'POST' is not allowed when accessing file '/webapitest/token'
>
> Description: HTTP 500.Error processing request.
> Details: Error processing request.
> Exception stack trace:
>    at System.Web.DefaultHttpHandler.BeginProcessRequest
> (System.Web.HttpContext context, System.AsyncCallback callback,
> System.Object state) in <filename unknown>:line 0
>    at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () in
> <filename unknown>:line 0
>    at System.Web.HttpApplication.Tick () in <filename unknown>:line 0
>
> Of course the entire directory containing the api and the client html page
> are chowned to apache user so it's not an obvious file access problem.
>
>
> So, some of the questions that I'm wondering are; does mono actually
> support owin authentication and bearer tokens? So far I've not found a
> definitive answer to that. I used an online tutorial to build this project
> as a proof-of-concept, it instructed me to use a number of Nuget packages
> including Microsoft.Owin.Host.SystemWeb, so if mono does support owin, it's
> just a matter of finding a way to implement the service without using that
> particular namespace. I'd appreciate if someone can point me to the right
> direction on how to get my project working.
>
> Thanks,
> Olli
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20151005/40cdf783/attachment.html>


More information about the Mono-list mailing list