部署在IIS上出现404:
修改 C:\Windows\System32\inetsrv\config\applicationHost.config 文件
连续查找requestFiltering,往下添加一行
<requestLimits maxAllowedContentLength="1073741824" />
里面的1073741824=1G。
<requestFiltering> <requestLimits maxAllowedContentLength="1073741824" /> <fileExtensions allowUnlisted="true" applyToWebDAV="true"> ................ </fileExtensions> </requestFiltering>
或者在本地web.config添加下面代码
<configuration> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="1073741824" /> </requestFiltering> </security> </system.webServer> </configuration>
另一种 404的可能性:
路径要添加绝对路径http://www.xxxx.com/swfupload/…… 或者 http://192.168.1.34/swfupload/……
flash_url: "http://www.xxxx.com/swfupload/swfupload.swf", upload_url: "http://www.xxxx.com/swfupload/imageUp.ashx", button_image_url: "http://www.xxxx.com/swfupload/up.png",
Web.Config要添加节点:
maxRequestLength的大小根据自己的需求设置1024000~=1G
<system.web> <httpRuntime maxRequestLength="1024000" executionTimeout="360" requestValidationMode="2.0" /> </system.web>
post_params 参数的设置:
因SWFUpload上传需要自己开辟Session 所以要在Globals中添加处理
post_params: { "ASPSESSID": "<%=Session.SessionID %>", "AUTHID": "<%=Request.Cookies[FormsAuthentication.FormsCookieName].Value%>" //微软MemberShip },
Globals.asax文件添加
Application_BeginRequest内添加
try { string session_param_name = "ASPSESSID"; string session_cookie_name = "ASP.NET_SESSIONID"; if (HttpContext.Current.Request.Form[session_param_name] != null) { UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]); } else if (HttpContext.Current.Request.QueryString[session_param_name] != null) { UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]); } } catch (Exception) { HttpContext.Current.Response.StatusCode = ; HttpContext.Current.Response.Write("Error Initializing Session"); } try { string auth_param_name = "AUTHID"; string auth_cookie_name = FormsAuthentication.FormsCookieName; if (HttpContext.Current.Request.Form[auth_param_name] != null) { UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]); } else if (HttpContext.Current.Request.QueryString[auth_param_name] != null) { UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]); } } catch (Exception) { HttpContext.Current.Response.StatusCode = ; HttpContext.Current.Response.Write("Error Initializing Forms Authentication"); }
void UpdateCookie(string cookie_name, string cookie_value) { HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name); if (cookie == null) { cookie = new HttpCookie(cookie_name); HttpContext.Current.Request.Cookies.Add(cookie); } cookie.Value = cookie_value; HttpContext.Current.Request.Cookies.Set(cookie); }
---------------------如果以上都注意了,基本应该没什么问题