惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - cloud

将博客搬至CSDN Microsoft Dynamics CRM 解决数据大于5000时,页面上只能导出5000+数据。 AX7 VM can not starting AX3空Invoice明细问题 Solution to “VirtualBox can't operate in VMX root mode” error in Windows 7 Inventory of the materials to teach you how to query a date certain combination of dimensions How to Debug Enterprise Portal Code in Dynamics AX 2009 Axapta 3 COM Connector AX 与Citrix打印机问题 AX ERP 真正的自动批处理 SQL语句转摘 AX2012 R2 打开EP站点时提示503 Service Unavailable错误。 AX2012 R2安装 AX3在window8下兼容性 转:Configure system accounts-AX2009 转:Workflow iPhone Application 转:Dynamics AX2009 Workflow – Checklist-Mail alert 转:AX 2009 Workflows: A Quick overview Dynamics AX2009 Report step by step
转 Request for the permission of type 'InteropPermission' failed.
cloud · 2012-08-27 · via 博客园 - cloud

http://blog.davidsandor.com/post/2009/07/16/Request-for-the-permission-of-type-InteropPermission-failed.aspx

http://dynamics-ax-live.blogspot.com.au/2009/09/error-request-for-permission-of-type.html

I am working with Microsoft Dynamics AX 2009 and when calling a method on one of my C# assemblies from X++ I got the error:

Request for the permission of type 'InteropPermission' failed.

image

After reading a few misguided newsgroup postings I found this article showing how to get around the error. Apparently in Axapta 2009 the hosted CLR requires that you assert permissions before you make a call to your assembly.

http://msdn.microsoft.com/en-us/library/bb190039.aspx

So I modified my code to include the InteropPermission class, instantiated it as a new object and called assert. Well I immediately noticed that I needed to construct the InteropPermission class with an InteropKind enumerator. So after a quick search I found this article:

http://msdn.microsoft.com/en-us/library/aa605505.aspx

Long story short, you can call your CLR code by using code like this:

   1:  void sendSalesOrderConfirmNotification(str salesOrderNumber)
   2:  {
   3:      XppNotifier.Notifier notifier;
   4:      XppNotifier.NotificationType notificationType;
   5:      InteropConfigTable iConfig;
   6:      KeyDataType key;
   7:      InteropPermission perm;
   8:    ;
   9:   
  10:      key = "NotificationMSMQQueuePath";
  11:      perm = new InteropPermission( InteropKind::ClrInterop );
  12:      perm.assert();
  13:   
  14:      notifier = new XppNotifier.Notifier();
  15:      notifier.FireNotification(iConfig.getValue(key), salesOrderNumber,  "", "", XppNotifier.NotificationType::SalesOrderConfirmation);
  16:   
  17:    info("Sales order confirmed, sending notifications: SalesId: " + salesOrderNumber);
  18:   
  19:   
  20:  }

Note: My C# assembly is the XppNotifier. I have to create an InteropPermission variable at line 7. Then at line 11 I instantiate the InteropPermission class. I pass in the ClrInterop enum because I am requesting access to call my C# assembly. On line 12 I make the assertion. This basically says to the CLR “Hey, I want to run some managed code. Is this cool?” the CLR then either throws a Code Access Security exception (CAS Exception) or returns quietly. However now, the current application domain that is executing has the right to invoke the C# assembly.

第二篇:

Error: "Request for the permission of type 'InteropPermission' failed."

Hi there,

Here's another error message you may come across in Dynamics Ax:

Error: "Request for the permission of type 'InteropPermission' failed."

You have written some code, tested it and everything went fine. Now the project has gone live, and all of a sudden, the code fails with the error message from above.
The code is probably executed in another context as when you tested it. For example by another user, or in batch.
The reason for the failure is the security measures that were implemented in Ax 4.0 and up.
What do you need to do? Assign permissions to execute the code (CLR Interop). Like this:

InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);
;
permission.assert();

If your error message is regarding a COM object that you are referencing, you can use this alternative:

InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
;
permission.assert();

You can read more about CAS or Code Access Security over at MSDN.