5
開頭我使用以下代碼來驗證用戶在我的asp.net應用程序中使用ServiceStack基本身份驗證提供程序並接收serilization exception.Please回答如果有人解決了這個問題,謝謝。服務堆棧:類型定義應以'{'開頭,期望序列化類型'AuthResponse',得到的字符串以
我用我的asp.net應用程序下面的代碼:
<asp:Button ID="btnAuth" runat="server" OnClick="btnAuth_Click" Text="Authenticate"/>
我在隱藏文件中的代碼上clien.Post方法 recieving例外。
protected void btnAuth_Click(object sender, EventArgs e)
{
try
{
var baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "/api";
var client = new JsonServiceClient(baseUrl);
var authResponse = client.Post<AuthResponse>(new Auth { UserName = "admin", Password = "12345" });
if (authResponse.ResponseStatus.ErrorCode == null)
{
//Do Something here
}
}
catch (WebServiceException ex)
{
throw ex;
}
}
富林偉業是我在clien.Post方法 recieving Exeception詳細信息:
[SerializationException: Type definitions should start with a '{', expecting serialized type 'AuthResponse', got string starting with:
看看這個帖子上接受的答案:http://stackoverflow.com/questions/12064166/how-to-use-servicestack-authentication-correctly-in-asp-net-mvc-controller希望可以幫助。 –
@DavidTansey,這與手頭的問題有什麼關係?我遇到了同樣的錯誤,我甚至沒有使用任何Web應用程序。問題在於對象序列化不是關於認證。 –
這個問題與MVC有關?如果不是,你可以糾正標籤嗎?謝謝 – Javier