询问者
求助:Asp.net 4.0向网络映射驱动器写入文件报错

问题
-
各位好,目前我的应用服务器如下:服务器A——Aspnet应用服务器,服务器B——文件服务器
我的Aspnet程序试图向文件服务器写入文件时报错“Could not find a part of the path ....”
在提问前,我已在网上搜了大家的解决办法,目前尝试了如下步骤:
1、在A、B中建立相同名称、密码的账户ishareuser
2、在A中建立B共享给ishareuser的文件夹的映射盘Z,使用ishareuser登录
3、在aspnet程序的web.config中加入<identity impersonate="true" userName="ishareuser" password="123456" />
4、将IIS7中的将应用程序池ASP.NET 4.0 Classis的标识设为ishareuser
5、C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files授予了ishareuser写入权限
执行程序,仍然报错,不能找到路径的一部分
另外,我的操作系统是win7,我很疑惑,我跟大家用的方法一致,为什么到我这就不行了呢,哪位高人给解答一下啊,谢谢了
- 已编辑 Cindy Fu 2012年9月11日 16:11
全部回复
-
补充一下,我在系统的事件查看器里看到了如下错误信息:
Application information:
Application domain: /LM/W3SVC/1/ROOT/BizPortalTest-3-129918510985366976
Trust level: Full
Application Virtual Path: /BizPortalTest
Application Path: C:\Deploy\Web2010 ora10.1.0.2-0814\
Machine name: CINDY-VPC6
Process information:
Process ID: 4076
Process name: w3wp.exe
Account name: CINDY-VPC6\ishareuser
Exception information:
Exception type: DirectoryNotFoundException
Exception message: Could not find a part of the path 'Z:\output\YKMSG.XML'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at System.Web.HttpPostedFile.SaveAs(String filename)
at System.Web.UI.WebControls.FileUpload.SaveAs(String filename)
at OperatingManagement.Web.Views.BusinessManage.SendFile.btnSend_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Request information:
Request URL: http://localhost/BizPortalTest/Views/BusinessManage/SendFile.aspx
Request path: /BizPortalTest/Views/BusinessManage/SendFile.aspx
User host address: ::1
User: admin
Is authenticated: True
Authentication Type: OMOnlineUser
Thread account name: CINDY-VPC6\ishareuser
Thread information:
Thread ID: 8
Thread account name: CINDY-VPC6\ishareuser
Is impersonating: False
Stack trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at System.Web.HttpPostedFile.SaveAs(String filename)
at System.Web.UI.WebControls.FileUpload.SaveAs(String filename)
at OperatingManagement.Web.Views.BusinessManage.SendFile.btnSend_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details: