发布SecurityPermission后WinApp失败 [英] WinApp fail after publishing SecurityPermission
问题描述
WinApp在Security.Permission.FileIOPermission上发布后失败
请求获得类型'System.Security.Permissions的许可。 DileIOPermission
在System.Windows.Forms.Application.get_StartupPath()
顺便说一下,可执行目录的更通用和正确的方法是:
string location = System.Reflection.Assembly.GetEntryAssembly()。Location;
string executableDirectory = System.IO.Path.GetDirectoryName(location);
我不认为它会消除异常,但是当其他方法给出不正确的结果时(例如,当应用程序托管不同时),此方法有效。
关于你的问题,请在你的问题的评论中看到我的问题并回答它。
-SA
WinApp failing after publishing on Security.Permission.FileIOPermission
Request for the permission of type 'System.Security.Permissions.DileIOPermission
at System.Windows.Forms.Application.get_StartupPath()
By the way, more universal and correct method of the executable directory is this:
string location = System.Reflection.Assembly.GetEntryAssembly().Location; string executableDirectory = System.IO.Path.GetDirectoryName(location);
I don't think it will eliminate the exception, but this method works when other methods give incorrect results (for example, when application hosting is different).
As to your problem, please see my question in the comments to your question and answer it.
—SA
这篇关于发布SecurityPermission后WinApp失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!