asp.net - Permission issue when webservice deployed as virtual directory.Works in VS IDE -
i have asp.net web service create text file in path being passed parameter method.
private void createfile(string path) { string strfilename = path; streamwriter sw = new streamwriter(strfilename, true); sw.writeline(""); sw.write("created @ " + datetime.now.tostring()); sw.close(); }
now passing folder in network parameter , calling method
createfile(@"\\192.168.0.40\\labels\\test.txt");
when running code visual studio ide,the file getting created in path.but when published , deployed virtual directoty,its throwing me error like
"system.unauthorizedaccessexception: access path '\\192.168.0.40\labels\test.txt' denied. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ 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) @ system.io.filestream..ctor(string path, filemode mode, fileaccess access, fileshare share, int32 buffersize, fileoptions options) @ system.io.streamwriter.createfile(string path, boolean append) @ system.io.streamwriter..ctor(string path, boolean append, encoding encoding, int32 buffersize) @ system.io.streamwriter..ctor(string path, boolean append)
i have in web.config.my machine running in xp , other in windows server 2003 . have set write permission "anyone" folder
any idea solve ?? in advance
your web application running under local aspnet user account, not have access resource on network. if have application pools in iis version, have make application pool user domain user has access network resource. if not have application pools, change user web in processmodel element of web.config.
Comments
Post a Comment