前端作文件上傳採用了jquery.form.js的ajaxSubmit方法,該方法可實現頁面無刷新提交form表單以及文件上傳。功能開發所用瀏覽器是谷歌,可是由於要求最低兼容ie8,功能開發完畢後,谷歌下完美運行,可是在ie8兼容模式下,卻報錯了,點了保存按鈕後,數據提交到了後端,後端報錯了,前端瀏覽器也由於後端報錯沒法返回,控制檯也出現了錯誤信息。錯誤信息以下:
前端
點開detailsjquery
PLATFORM VERSION INFO Windows : 6.1.7601.65536 (Win32NT) Common Language Runtime : 4.0.30319.1026 System.Deployment.dll : 4.0.30319.1039 (RTMGDR.030319-1000) clr.dll : 4.0.30319.1026 (RTMGDR.030319-1000) dfdll.dll : 4.0.30319.1039 (RTMGDR.030319-1000) dfshim.dll : 4.0.31106.0 (Main.031106-0000) SOURCES Deployment url : https://localhost:8070/Record/RecordFilePut ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of https://localhost:8070/Record/RecordFilePut resulted in exception. Following failure messages were detected: + Downloading https://localhost:8070/Record/RecordFilePut did not succeed. + The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. + The remote certificate is invalid according to the validation procedure. COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected. WARNINGS There were no warnings during this operation. OPERATION PROGRESS STATUS * [2018-12-18 13:55:18] : Activation of https://localhost:8070/Record/RecordFilePut has started. ERROR DETAILS Following errors were detected during this operation. * [2018-12-18 13:55:18] System.Deployment.Application.DeploymentDownloadException (Unknown subtype) - Downloading https://localhost:8070/Record/RecordFilePut did not succeed. - Source: System.Deployment - Stack trace: at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next) at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles() at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState) at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation) at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation) at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state) --- Inner Exception --- System.Net.WebException - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. - Source: System - Stack trace: at System.Net.HttpWebRequest.GetResponse() at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next) --- Inner Exception --- System.Security.Authentication.AuthenticationException - The remote certificate is invalid according to the validation procedure. - Source: System - Stack trace: at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.ConnectStream.WriteHeaders(Boolean async) COMPONENT STORE TRANSACTION DETAILS No transaction information is available.
一開始看到ie報錯,第一反應是js不兼容,好比jquery版本或者jquery.form.js版本不兼容,一度試圖更換版本。ajax
聽說jq2.0以上都再也不支持ie8 個人jq是在2.0如下。
json
聽說ie在在上傳文件的時候回出現下載框,是響應類型沒有設置,在後端獲取到httpservletresponse對象,而後設置響應類型爲text/json.可是依然沒用後端
而後就瘋狂翻帖子 找解決辦法,終於看到一個大神說設置 produces="text/json"
瀏覽器
註解RequestMapping中produces屬性能夠設置返回數據的類型以及編碼,能夠是json或者xml:app
@RequestMapping(value="/xxx",produces = {"application/json;charset=UTF-8"})
或
@RequestMapping(value="/xxx",produces = {"application/xml;charset=UTF-8"})
可是必需要和@ResponseBody
註解一塊兒使用才能夠,不加@ResponseBody
註解至關於按照和返回String同名jsp頁面解析天然就會報錯。jsp