我在IIS 7共享托管环境中有一个网站.它运行的是.NET 3.5.我有一个下载按钮从服务器下载文件.
当我将此应用程序本地部署到IIS 6时,它运行正常.在IIS 7共享主机服务器上,发生异常.
句柄无效.(来自HRESULT的异常:0x80070006(E_HANDLE))描述:在执行当前Web请求期间发生了未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
System.Runtime.InteropServices.COMException:句柄无效.(来自HRESULT的异常:0x80070006(E_HANDLE))
COMException(0x80070006):句柄无效.(来自HRESULT的异常:0x80070006(E_HANDLE))] [HttpException(0x80004005):与远程主机通信时发生错误.错误代码是0x80070006.]
怎么解决这个问题?
string strRequest = Convert.ToString(Request.QueryString.Get("file"));
System.IO.FileInfo file = new System.IO.FileInfo(strRequest);
if (file.Exists)
{
Response.Clear();
Response.ContentType = ReturnExtension(System.IO.Path.GetExtension(file.Name));
Response.AppendHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.TransmitFile(strRequest);
Response.End();
HttpContext.Current.ApplicationInstance.CompleteRequest();
//DownloadFile(file.FullName, file.Name);
}
Run Code Online (Sandbox Code Playgroud) 我想通过ftp从android sdcard文件夹上传xml文件,我正在尝试将此代码连接到ftp:
FTPClient f = new FTPClient();
f.connect(server,21);
f.login(username,password);
Log.d("status",f.getStatus());
f.logout();
f.disconnect();
Run Code Online (Sandbox Code Playgroud)
但我得到例外
例外:
java.net.SocketException:权限被拒绝