
Untitled
By: a guest on
Jul 20th, 2012 | syntax:
None | size: 2.78 KB | hits: 15 | expires: Never
Jquery WCF error processing
[OperationContract]
[FaultContract(typeof(MyError))]
[WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Data GetStores(int dataViewID, string filter, MapExtent extent);
$.ajax({
url: serviceurl + 'GetStore',
type: 'POST',
contentType: 'application/json',
dataType: "json",
data: ....
success: function (result) {
},
error: function (xhr) {
ShowError(xhr);
}
});
MyError error = new MyError() { Problem = message };
throw new FaultException<MyError>(error, new FaultReason(error.Problem));
"<?xml version="1.0" encoding="utf-8"?><HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE>
<TITLE>Request Error</TITLE></HEAD><BODY>
<DIV id="content">
<P class="heading1">Request Error</P>
<BR/>
<P class="intro">The server encountered an error processing the request. The exception message is 'You are not currently logged in or your session has expired'. See server logs for more details. The exception stack trace is:</P>
<P class="intro"> My.cs:line 1728
at ServiceBase.CheckAuthentication() in ServiceBase.cs:line 96
.....
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</P>
</DIV>
</BODY></HTML>"
error: function(xhr, description, error) {
alert(description);
alert(error);
}
$.ajax({
url: serviceurl + 'GetStore',
type: 'POST',
contentType: 'application/json',
dataType: "json",
data: ....
success: function (result) {
},
error: function(xhr, description, error) {
alert(description);
alert(error);
}
});