내가, 내가 data
을ASP.NET ActionResult는
public ActionResult PerformMagic(string a, string b, int c)
{
try
{
// Some code which always gives an error and go to catch block
}
catch (Exception ex)
{
// ex.Message = "An error occured"
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return this.Content(System.Web.Helpers.Json.Encode(new { error = ex.Message }), "application/json");
}
}
그래서 전화가 아래의 결과를 반환하는 다음 코드 그래서
{
config : {method: "GET", transformRequest: Array(1), transformResponse: Array(1), jsonpCallbackParam: "callback", paramSerializer: ƒ, …}
data :
error : "An error occured"
__proto__ : Object
headers : ƒ (name)
status : 400
statusText : ""
__proto__ : Object
}
를 얻을 수있다 호스팅 로컬 호스트와 푸른 웹 서비스에 대해 서로 다른 응답을 제공합니다 JSON 내부에서 error
을 찾아 값 (An error occured
)을 경고로 표시하십시오.
하지만 푸른 응용 프로그램 서비스에이를 배포하고 실행할 때, 응답이 의미
{
config : {method: "GET", transformRequest: Array(1), transformResponse: Array(1), jsonpCallbackParam: "callback", paramSerializer: ƒ, …}
data : "Bad Request"
headers : ƒ (name)
status : 400
statusText : "Bad Request"
__proto__ : Object
}
아래로 온다, 나는 data
내부 error
를 찾을 수 없습니다. 아무도 왜 이런 행동을하는지 설명 할 수 있습니까?
내 첫번째 추측은 디버깅 로컬 활성화 및 예외 정보를 반환하지 않습니다 하늘빛의 릴리스 버전을 배포하는 것입니까? 예외가 정보 유출이 될 수 있기 때문에 이것은 좋은 일입니다. –
@RickvandenBosch 디버그 설정에서 앱을 배포 할 때도 동일한 동작이 발생합니다. –