أوث طلب المستهلك لرمز من ServiceProvider يعود InternalServerError

StackOverflow https://stackoverflow.com/questions/1400674

سؤال

وأنا حول اللعب مع DevDefined.OAuth - التنفيذ المستهلك أوث ومزود لصافي <لأ href = "http://code.google.com/p/devdefined-tools/wiki/OAuth" يختلط = " noreferrer نوفولو "> http://code.google.com/p/devdefined-tools/wiki/OAuth و على إطلاق مشروع ExampleConsumerSite بعد تكوين نقاط النهاية خدمة بلدي على خادم الويب IIS 7، وأنا تلقي الخطأ التالية:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Request for uri: http://localhost:8080/RequestToken.aspx?oauth_callback=oob&oauth_nonce=94efde0b-dd45-4cee-8253-7496cef0b877&oauth_consumer_key=key&oauth_signature_method=PLAINTEXT&oauth_timestamp=1252512419&oauth_version=1.0&oauth_token=&oauth_signature=secret%2526 failed.
status code: InternalServerError

An error occurred during the parsing of a resource required to service this request.   Please review the following specific parse error details and modify your source file appropriately.

Source Error:
[HttpException]: 'RequestToken' is not allowed here because it does not extend class 'System.Web.UI.Page'.
  at System.Web.UI.TemplateParser.ProcessError(String message)
  at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
  at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
[HttpParseException]: 'RequestToken' is not allowed here because it does not extend class 'System.Web.UI.Page'.
  at System.Web.UI.TemplateParser.ProcessException(Exception ex)
  at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
  at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
[HttpParseException]: 'RequestToken' is not allowed here because it does not extend class 'System.Web.UI.Page'.
  at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
  at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath)
  at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
  at System.Web.UI.TemplateParser.ParseInternal()
  at System.Web.UI.TemplateParser.Parse()
  at System.Web.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath)
  at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
  at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
  at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
  at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
  at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
  at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
  at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
  at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
  at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
  at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
  at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
  at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
  at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

ولقد لاحظت المعلمة oauth_token GET فارغة. على تتبع ذلك، فإن مصدر الخطأ هو من خط 12 من الصفحة Default.aspx.cs:

IToken requestToken = session.GetRequestToken();

protected void oauthRequest_Click(object sender, EventArgs e)
{
  OAuthSession session = CreateSession();

  IToken requestToken = session.GetRequestToken();

  if (string.IsNullOrEmpty(requestToken.Token))
  {
    throw new Exception("The request token was null or empty");
  }

  Session[requestToken.Token] = requestToken;

  string callBackUrl = "http://localhost:" + HttpContext.Current.Request.Url.Port + "/Callback.aspx";

  string authorizationUrl = session.GetUserAuthorizationUrlForToken(requestToken, callBackUrl);

  Response.Redirect(authorizationUrl, true);
}

وبينما أنا لست متأكدا إذا كان هذا له علاقة مع تكوين النهاية الخدمة ولكن أنا على التوالي المشروع المستهلك من VS2008 واستضافة الخدمة على IIS. يرجى تقديم المشورة.

هل كانت مفيدة؟

المحلول

العمل الآن. كان الخطأ يرجع إلى RequestToken.aspx الصفحة في OAuthChannel لا وراثة الدرجة الصحيحة وراء ذلك عندما الموقع المستهلك تبذل طلب للحصول على الرمز المميز الذي نتج عن خطأ في الخادم الداخلي على الجانب ServiceProvider.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top