当我在本地计算机上测试时,它是英语。
当我部署到位于 HK\China 的 Web 服务器时,它是乱码。
我已经将文化信息强制转换为英文,还是一样。
无论如何,我都想用英语记录异常,然后相应地向用户显示异常,而不是乱码。
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
try
{
...
}
catch (SAP.Connector.RfcSystemException rfcSystemException)
{
LogHandler.LogError(logger, "", rfcSystemException);
ShowMessage("RfcSystemException", rfcSystemException.Message);
}
消息:材料 XXX 未在工厂 YYY 中维护
错误代码:RFC_ERROR_SYSTEM_FAILURE
来源:SAP.Connector.Rfc
堆栈跟踪:
在 SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo,编码编码,字符串语言代码)在 SAP.Connector.Rfc.RfcClient.RfcInvoke(SAPClient 代理,字符串方法,Object[] methodParamsIn)在 SAP.Connector.SAPClient.SAPInvoke(字符串方法,Object[] methodParamsIn) at DrawingReq_BAPI.SAPProxy1.Zats_Create_Sourcelist(String Material, String Plant, String Purorg, String Valid_From, String Valid_To, String Vendor_Code) at ComparePrice.btnUpload_Click(Object sender, EventArgs e) in d:\TFS\XXX \ComparePrice.aspx.cs:第 688 行