我试图使用默认的Facebook模板为Asp.Net MVC创建一个Facebook应用程序。我在developers.facebook.com注册并创建了一个应用程序。
我使用以下步骤创建了基于ASP.NET的MVC网页:
现在,如果我运行应用程序,它请求Facebook登录并登录到Facebook。但之后它会生成以下错误,而不是显示默认的MVC网页。感谢是否有人可以给我指导。
' /'中的服务器错误应用
无法将字符串转换为整数:public_profile。路径'数据[0]。许可',第1行,第39位。 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:Newtonsoft.Json.JsonReaderException:无法将字符串转换为整数:public_profile。路径'数据[0]。许可',第1行,第39位。
来源错误: 在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。
堆栈追踪:
[JsonReaderException:无法将字符串转换为整数:public_profile。路径'数据[0]。许可',第1行,第39位。
Newtonsoft.Json.JsonReader.ReadAsInt32Internal()+ 921
Newtonsoft.Json.JsonTextReader.ReadAsInt32()+39
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader,JsonContract contract,Boolean hasConverter)+228
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IWrappedDictionary wrappedDictionary,JsonReader reader,JsonDictionaryContract contract,JsonProperty containerProperty,String id)+1469
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerMember,Object existingValue)+866
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerMember,Object existingValue)+184
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IWrappedCollection wrappedList,JsonReader reader,JsonArrayContract contract,JsonProperty containerProperty,String id)+1180
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,Object existingValue,String id)+698
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerMember,Object existingValue)+233
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty属性,JsonConverter propertyConverter,JsonContainerContract containerContract,JsonProperty containerProperty,JsonReader reader,Object target)+598
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject,JsonReader reader,JsonObjectContract contract,JsonProperty member,String id)+1799
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerMember,Object existingValue)+517
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader,Type objectType,JsonContract contract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerMember,Object existingValue)+184
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader,Type objectType,Boolean checkAdditionalContent)+740
Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader,Type objectType)+1143
Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader,Type objectType)+47
Newtonsoft.Json.JsonConvert.DeserializeObject(String value,Type type,JsonSerializerSettings settings)+193
Newtonsoft.Json.JsonConvert.DeserializeObject(String value,Type type)+44
Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper,String responseString,Type resultType,Boolean containsEtag,IList 1 batchEtags) +2070
Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType) +1168
Facebook.FacebookClient.Get(String path, Object parameters, Type resultType) +52
Facebook.FacebookClient.Get(String path, Object parameters) +139
Facebook.FacebookClient.Get(String path) +100
Microsoft.AspNet.Mvc.Facebook.Client.FacebookClientExtensions.GetCurrentUserPermissions(FacebookClient client) +74
Microsoft.AspNet.Mvc.Facebook.Providers.DefaultFacebookPermissionService.GetUserPermissions(String userId, String accessToken) +217
Microsoft.AspNet.Mvc.Facebook.Authorization.FacebookAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) +5182
System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList
1个过滤器,ActionDescriptor actionDescriptor)+143
System.Web.Mvc.Async。<> c__DisplayClass25.b__1e(AsyncCallback asyncCallback,Object asyncState)+978
System.Web.Mvc.Async.WrappedAsyncResult 1.Begin(AsyncCallback callback, Object state, Int32 timeout) +161
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate
1 endDelegate,Object tag,Int32 timeout)+92
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate 1 endDelegate, Object tag) +53
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +523
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +83
System.Web.Mvc.Async.WrappedAsyncResult
1.Begin(AsyncCallback callback,Object state,Int32 timeout)+161
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate 1 endDelegate, Object tag, Int32 timeout) +92
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +97
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +53
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +501
System.Web.Mvc.Async.WrappedAsyncResult
1.Begin(AsyncCallback callback,Object state,Int32 timeout)+161
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate 1 endDelegate, Object tag, Int32 timeout) +92
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +97
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +53
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +417
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +49
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +127
System.Web.Mvc.Async.WrappedAsyncResult
1.Begin(AsyncCallback callback,Object state,Int32 timeout)+161
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate`1 endDelegate,Object tag,Int32 timeout)+92
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate endDelegate,Object tag,Int32 timeout)+97
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback,Object state,BeginInvokeDelegate beginDelegate,EndInvokeDelegate endDelegate,Object tag)+53
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext,AsyncCallback回调,对象状态)+373
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,AsyncCallback回调,对象状态)+88
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context,AsyncCallback cb,Object extraData)+50
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+301
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+155
谢谢&amp; BR,
艾哈迈德
答案 0 :(得分:0)
这是Newtonsoft.Json库中的解析问题。某些字符串无法解析为整数。
尝试确保安装Newtonsoft.Json库的最新更新版本。