System.UnauthorizedAccessException:xml文件拒绝访问

本地调试一切正常,但上传到服务器就会报错:
System.UnauthorizedAccessException: 对路径“……”的访问被拒绝。 在 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, Boolean useLongPath, Boolean checkHost) 在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 在 System.Xml.XmlDocument.Save(String filename) 在 AOWEN.Web.Controllers.ActivitiesController.AddMonthlyActivity(String[] kclist, String campname, DateTime effective, DateTime deadline, Int32 type, String kctype, String gift)
代码如下:
图片说明

应该怎么解决昂?

对路径的访问被拒绝,我最直接的想法就是服务器上你存文件的那个路径没有给权限。试试到服务器上,给你服务器程序文件夹或者仅仅保存上传文件的文件夹以读写权限试一下。