DotNetOpen​Auth in IIS7; request not available

2019-08-27 21:04发布

问题:

Recently the company I work for has begun implementing OAuth in one of their web services. However, yesterday I came across a rather unusual problem.

When debugging the application on a remote computer, I receive the following error: "System.Web.HttpException: Request is not available in this context". Now, when I first encountered this problem I found out that this usually has to do with the fact that I can't use the HttpContext object in the Application_Start method of Global.cs, so I removed all references to that object from the method (as described here; http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx)

However, the problem persists when running the code on the remote computer (which is where IIS7 configuration Manager is installed). What's more, the stack trace refers to a path named "C:\rws\lib \dnoatst.net4\Samples\ZuydOAuthServiceProvider\Code\Global.cs", which makes no sense to me because the actual files are located on the D:\ disk. I cannot find a reference to that path anywhere in the source code.

Does anyone have any experience with this particular issue? Any help would be greatly appreciated!

回答1:

After some testing, it seems that there is a solution to this issue, albeit not a perfect one. Setting the Application Pool's managed pipeline mode to "Classic" seems to do the trick, however, I am somewhat worried that this will cause problems at a later stage.

If anyone knows how to solve the problem described in my initial post without using Classic managed pipeline mode, I would appreciate you sharing your thoughts.