AjaxControlToolkit 的 AsyncFileUpload 在线部署时行为异常
如果重要的话,以下内容位于工具包弹出窗口中,其中有一个更新面板。
<p>
<asp:Label Text="Picture" runat="server" Width="75"></asp:Label>
<ajaxToolkit:AsyncFileUpload ID="MediaPicture" runat="server" Width="200"
OnClientUploadStarted="BlockSubmits" ClientIDMode="AutoID"
OnClientUploadError="UnblockSubmits" PersistFile="true"
OnClientUploadComplete="UnblockSubmits"
/>
</p>
JavaScript 函数只是阻止/释放提交按钮,以防止上传过程中出现问题。
这在本地主机上运行良好,但是当在线部署在 GoDaddy 服务器上时,我似乎无法上传超过几 KB 的文件,即使在本地我可以上传更大的文件(~2MB)...
我似乎找不到出现此行为的原因可能是 IIS 上的问题吗?我在上传完成之前读到了一些有关应用程序池清理的内容,这可能会发生吗?
顺便说一句,为了以防万一,服务器端我只是从这个控件中取出图片
byte[] picture = MediaPicture.FileBytes ?? (string.IsNullOrEmpty(mediaID) ? null : Media.SelectByID(int.Parse(mediaID)).GetPicture());
其中有一些额外的逻辑关于我是否处于编辑模式,如果当前记录有图片,我会接管它没有图片,
然后我将其存储在数据库中。
关于为什么会发生这种情况有什么想法吗?
谢谢!
In case it matters, the following is inside a toolkit popup, which has an update panel in it.
<p>
<asp:Label Text="Picture" runat="server" Width="75"></asp:Label>
<ajaxToolkit:AsyncFileUpload ID="MediaPicture" runat="server" Width="200"
OnClientUploadStarted="BlockSubmits" ClientIDMode="AutoID"
OnClientUploadError="UnblockSubmits" PersistFile="true"
OnClientUploadComplete="UnblockSubmits"
/>
</p>
The javascript functions just block / release a submit button, to prevent problems during uploads.
This works fine on localhost, but when deployed online on a GoDaddy server, I can't seem to upload files over a few KB, even when locally I could upload bigger files (~2MB)...
I can't seem to find the reason for this behavior, could it be on the IIS? I read something about the app pool clearing before the upload could complete, could this be happening?
Btw, just in case, server-side I just take the picture out of this control
byte[] picture = MediaPicture.FileBytes ?? (string.IsNullOrEmpty(mediaID) ? null : Media.SelectByID(int.Parse(mediaID)).GetPicture());
There's some extra logic in there about whether I'm in edit mode or not, and if the current record has a picture, I'll take that over no picture,
And then I store it on the database.
any thoughts as to why this might be happening?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我正确理解您的情况,问题是由位于 updatepanel 内部的 AsyncFileUpload 引起的,从而在回发期间发生文件上传...
这个 博客文章对原因有一个很好的解释。
至于为什么它在本地工作,如果是上面解释的问题,那是因为浏览器处理来自“互联网”域的“本地”的方式。
If I understand your situation correctly, the problem is caused by the AsyncFileUpload being located inside the updatepanel, thereby having the file upload happen during a postback...
This blog post has a decent explanation of why.
As for why it works locally, if it is the problem as explained above, it's because of the way the browser handles "local" from "internet" domains.
ajax工具包的Assync上传还是要有ASP.NET最大请求大小的post。
此最大大小在应用程序的 web.config 和 IIS 内设置。由于您使用的是第三方提供商...尝试摆弄部分中的 web.config
如果这对您没有帮助,请查看 SWFUpload 控件...救了我几次。
问候,
The Assync upload of the ajax toolkit still has to have a post with the maximum request size of ASP.NET.
This max size is setted in the web.config of your application AND inside IIS. Since you are using a third party provider... try to fiddle with the web.config in the section
If this won't help you out, check out the SWFUpload control... saved my skin a couple of times.
Regards,
我猜您在开发环境和生产服务器(在本例中为 GoDaddy)中使用了不同的 IIS 版本。您能否验证并让我知道确切的 IIS 版本,以便我为您提供更好的解决方案?原因 IIS 7.0 的配置与 IIS 6.0 略有不同。
I guess you use different IIS versions in your development environment and in the the production server (in this case Go Daddy).Can you verify and let me know the exact IIS versions so that I can provide you a better solution? Cause IIS 7.0 has a slightly different configuration than IIS 6.0.
我遇到了完全相同的问题,但将网站包含在 IE 的“本地 Intranet”区域中,安全设置是一种解决方法。
不过,我更新了Ajax Control Toolkit,问题就完全解决了。不再需要搞乱安全设置。
I was experiencing the exact same problem, but including the website in the "Local Intranet" zone in IE the security setting was a workaround.
However, I updated the Ajax Control Toolkit and the problem was completely solved. There is no more need to mess with the security setting.