Our support engineers have assembled the top recommended solutions for you.
Microsoft Dynamics AX 2012CRM Connector in Microsoft Dynamics AX 2012Financials Management in Microsoft Dynamics AX 2012Upgrading to Microsoft Dynamics AX 2012
Microsoft Dynamics AX 2009
Application Object Server (AOS)
Enterprise Portal and Role Centers
Inventory Costing in Microsoft Dynamics AX 2009
Invoice Settlements/Discounts/Reversals
SSRS and SSAS Integration
Workflow
Hello, I need to create a menu that should look like a diagram, and when you click on it, it opens the previosuly defined forms, I have currently three options:
Using a ManagedHost control to present an aspx website
Using a visio document to click on its elements
Using a Windows form and load into AX
If I use a Visio document, I can load it into a form using ActiveX but I can't click on its elements to open other forms; I tried loading an aspx page using a WebBrowser control but when I use this to load an AX form:axComClient.OpenMenuItem("CEU", "CustTableListPage", AxClientLib.AxMenuType.DisplayMenu);
It gives me errors about permissions and it does not open the form.
I would like to use a Windows Form, and I select a ManagedHost control "Form" type but I don't know how to load my form from it, could yo help me out? I hope I was clear enough, thanks!
I would use a ManagedHost with a WinForms control (or rather a WPF control in my case, but that's almost the same from AX perspective).You need to add a reference to the file containing your WinForms types and then select the type when adding a ManagedHost control to an AX form.See the tutorial I wrote for WPF controls, the referencing is the same for WinForms (ignore all the stuff about WPF development).
Of course things like issues with permissions can be resolved, but using a WinForms/WPF control makes better sense to me in this case.
[ Goshoom.NET Dev Blog ]
Thanks a lot for the suggestion, I actually created a WPF and added it to an AX form, and it works perfect, however, I'd like to use also an aspx page since I feel it gives me more freedom to design my diagram like menu, this is the error that it gives me when I try to open a form (the aspx page):
Retrieving the COM class factory for component with CLSID {49C0216A-3FDB-4F16-89AA-6E50B8D5ACE2} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {49C0216A-3FDB-4F16-89AA-6E50B8D5ACE2} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
The error points to this line:
AxClientLib.DynamicsAxApplication axComClient = new AxClientLib.DynamicsAxApplication();
Maybe you can help me out here, I already added LOCAL_SERVICE, NETWORK_SERVICE, WSS_ADMIN_WPG, WSS_WPG, IIS_IUSRS user permissions to the site in IIS7 but it still gives me that error, and it works fine if I run it from Visual Studio, this only fails when running from IIS, including AX, thanks!
It looks like you try to add an ASP.NET control to ManagedHost, but it won't work. ASP.NET controls need to be run by a process hosting ASP.NET runtime, typically by IIS.
You could host your ASP.NET control on IIS and display it in the form via HTML control (X++) or WebBrowser control (WinForms/WPF).
I would oppose the statement that ASP.NET gives you more flexibility in designing GUI than WPF, but it's your choice.
Actually, I'm using a WebBrowser control through ManagedHost, it works great when running from Visual Studio by the way, and I also tried with an ActiveX control, same result.
I said that about WPF because I'm not an expert on it but I think is powerful indeed, maybe I should try to do more research on it, however, I'd like to know why the aspx does not work, it's running on IIS7, thanks a lot!
All right, I understand what you say.
Does it work if you open the address in a normal browser? If not, it's not time yet to try it from AX.
Do you have a full call stack? What component is {49C0216A-3FDB-4F16-89AA-6E50B8D5ACE2}? Do you get the same error is you use an empty control or it depends on something you actually use inside?
Apparently there may be many reasons for this error and I have no idea which applies to your scenario. If you do some basic debugging by yourself and document the results here (or maybe rather in an ASP.NET forum if it occurs not to be a problem with ManagedHost), you'll have a better chance to get an answer.
Here's the scenario, it's an aspx page which does the following:
private void button1_Click(object sender, EventArgs e)
{
DynamicsAxApplication axComClient = new AxClientLib.DynamicsAxApplication();
axComClient.OpenMenuItem("CEU", "CustStatistics", AxClientLib.AxMenuType.DisplayMenu);
}
It works with no problems if I run it from Visual Studio itself (using localhost), however, if I run the same site hosted in IIS7 it gives me the error:
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {49C0216A-3FDB-4F16-89AA-6E50B8D5ACE2} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
System.Activator.CreateInstance(Type type, Boolean nonPublic) +106
SkunkWebApp._Default.myButton_Click(Object sender, EventArgs e) in C:\Users\Administrator\Documents\Visual Studio 2010\Projects\SkunkWebApp\SkunkWebApp\Default.aspx.cs:20
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691
So the question is not about ManagedHost at all - you want to know how to use AX COM API from from an ASP.NET control.
The answer is: Don't do it. You're going to big troubles with such an architecture.
You basically ask the web server to send requests (not just a response) to your AX client and to do it via COM. The web server needs to be able to construct the COM object - unless ax32 supports DCOM, you have to run the AX client on the same machine as the web server. You may need to configure IIS to allow to load such COM object etc. etc.
And that all just because you don't want to use managed form controls intended for exactly this purpose.
I understand what you say, I've been playing with WPF and I take back what I said, it's really good and it seems like you can do very complex things with it, so I'll stick with it since has not given me problems so far. THANKS A LOT for the help, really!!
Other vendors have developed entire user interfaces with WPF ... would be nice to see AX the same...