更新时间:2023-10-10 12:11:40
您读过错误消息吗?很清楚问题出在哪里,辅助程序集中的某件东西正在请求UIPermission特权,并且不允许这样做.
WebRequest只需要WebPermission(根据其文档),所以我想您正在做您没有告诉我们的其他事情.例如,Console.WriteLine需要UIPermission,MessageBox.Show也需要UIPermission.
Did you read the error message? It is quite clear what the problem is, something in your secondary assembly is requesting the UIPermission privilege and it isn''t allowed to do it.
WebRequest only requires the WebPermission (according to its documentation), so I guess you are doing something else you haven''t told us. For example Console.WriteLine requires UIPermission, as does MessageBox.Show.