Try adding
[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
above your method that involves the IO activity. F/E, the following copies "myFile" to the program files directory:
[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
public void copyFile(string myFile){
System.IO.File.Copy(myFile,Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…