C# jQuery/ASMX:在C中反序列化JSON时出错#

C# jQuery/ASMX:在C中反序列化JSON时出错#,c#,jquery,json,ajax,web-services,C#,Jquery,Json,Ajax,Web Services,我正在针对一个C#asmxweb方法发布一篇AJAX文章,但我无法获取要反序列化的JSON数据。这应该是可行的,但给了我以下的错误 {"Message":"Cannot convert object of type \u0027System.String\u0027 to type \u0027System.Collections.Generic.IDictionary`2[System.String,System.Object]\u0027","StackTrace":" at System.

我正在针对一个C#asmxweb方法发布一篇AJAX文章,但我无法获取要反序列化的JSON数据。这应该是可行的,但给了我以下的错误

{"Message":"Cannot convert object of type \u0027System.String\u0027 to type \u0027System.Collections.Generic.IDictionary`2[System.String,System.Object]\u0027","StackTrace":" at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)\r\n at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
这是WebMethod

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void SaveProfileProperties(string data)
    {
        ups.Credentials = System.Net.CredentialCache.DefaultCredentials;
        try
        {
            System.IO.File.WriteAllText(@"E:\Log.txt", data);
        }
        catch { }

        var json = new JavaScriptSerializer();
        Dictionary<string, string> props = json.Deserialize<Dictionary<string, string>>(data);
        SaveSQLData(props);
    }
更新:这是客户端。经过一些测试,我发现我文章开头的堆栈跟踪错误实际上是客户端错误

更新2:发现JSON序列化在客户端失败。以下是准备数据的正确方法

json.Stringify({data:{\"userName\":\"Doe\",\"UserProfile_GUID\":\"\",\"AccountName\":\"Domain\\Doe\",\"FirstName\":\"John\",\"LastName\":\"Doe\",\"PreferredName\":\"John Doe\",\"WorkPhone\":\"2176\",\"Department\":\"PHI\",\"Title\":\"Director\",\"SPS-JobTitle\":\"Director\",\"Manager\":\"Domain\\jdoe\",\"PersonalSpace\":\"/my/personal/Doe/\",\"PictureURL\":\"Doe_MThumb.jpg\",\"UserName\":\"Doe\",\"SPS-ClaimProviderID\":\"Windows\",\"SPS-ClaimProviderType\":\"Windows\",\"SPS-SavedAccountName\":\"Domain\\Doe\",\"SPS-DistinguishedName\":\"CN=John Doe,CN=Users,DC=domain,DC=local\",\"SPS-LastKeywordAdded\":\"1/2/2014 12:00:00 AM\",\"WorkEmail\":\"Doe@domain.com\",\"CellPhone\":\"5555555555\",\"Office\":\"C28\",\"SPS-TimeZone\":\"WF_Service.UPS.SPTimeZone\",\"personalEmail\":\"Doe.John@gmail.com\",\"SPS-EmailOptin\":\"0\",\"empID\":\"224\",\"team\":\"A\",\"p_id\":\"224\",\"username\":\"Doe\",\"last_name\":\"Doe\",\"first_name\":\"John\",\"birthday\":\"1/2/1985 12:00:00 AM\",\"anniv\":\"6/4/2007 12:00:00 AM\",\"imageurl\":\"A0BB.jpg\",\"Position\":\"Director\",\"dept_started_in\":\"IT\",\"birthplace\":\"NC\",\"marital_status\":\"Married\",\"sports_team\":\"Sporty Sports\",\"last_school\":\"None\",\"hobbies\":\"\",\"pets\":\"\",\"prior_employer\":\"None\",\"resides_in\":\"USA\",\"quote\":\"“Where you live should not determine whether you live, or whether you die.”  -- Bono\",\"fav_color\":\"009933\"}}

你能试试下面链接中的方法吗

我试着使用字典,但也遇到了同样的错误。
json.Stringify({data:{\"userName\":\"Doe\",\"UserProfile_GUID\":\"\",\"AccountName\":\"Domain\\Doe\",\"FirstName\":\"John\",\"LastName\":\"Doe\",\"PreferredName\":\"John Doe\",\"WorkPhone\":\"2176\",\"Department\":\"PHI\",\"Title\":\"Director\",\"SPS-JobTitle\":\"Director\",\"Manager\":\"Domain\\jdoe\",\"PersonalSpace\":\"/my/personal/Doe/\",\"PictureURL\":\"Doe_MThumb.jpg\",\"UserName\":\"Doe\",\"SPS-ClaimProviderID\":\"Windows\",\"SPS-ClaimProviderType\":\"Windows\",\"SPS-SavedAccountName\":\"Domain\\Doe\",\"SPS-DistinguishedName\":\"CN=John Doe,CN=Users,DC=domain,DC=local\",\"SPS-LastKeywordAdded\":\"1/2/2014 12:00:00 AM\",\"WorkEmail\":\"Doe@domain.com\",\"CellPhone\":\"5555555555\",\"Office\":\"C28\",\"SPS-TimeZone\":\"WF_Service.UPS.SPTimeZone\",\"personalEmail\":\"Doe.John@gmail.com\",\"SPS-EmailOptin\":\"0\",\"empID\":\"224\",\"team\":\"A\",\"p_id\":\"224\",\"username\":\"Doe\",\"last_name\":\"Doe\",\"first_name\":\"John\",\"birthday\":\"1/2/1985 12:00:00 AM\",\"anniv\":\"6/4/2007 12:00:00 AM\",\"imageurl\":\"A0BB.jpg\",\"Position\":\"Director\",\"dept_started_in\":\"IT\",\"birthplace\":\"NC\",\"marital_status\":\"Married\",\"sports_team\":\"Sporty Sports\",\"last_school\":\"None\",\"hobbies\":\"\",\"pets\":\"\",\"prior_employer\":\"None\",\"resides_in\":\"USA\",\"quote\":\"“Where you live should not determine whether you live, or whether you die.”  -- Bono\",\"fav_color\":\"009933\"}}