AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.06.2007, 22:41   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
Dynamics AX: .Net BC Custom App, One Step Back! [Connection]
Источник: http://dynamics-ax.blogspot.com/2007...step-back.html
==============
At the request of one of my readers, let me take a step back and talk about the Business Connector and how to make a successful connection to a Dynamics AX instance through it.

So to set this up let's talk about some important things here. One the Business Connector Proxy. This is the account that is used to start a BC session, in which all "connections" for the shared application pool for IIS go through.

In the EP example you supply this in the Business Connector Proxy form, and then the Applicaiton Pool that is running the SharePoint Portal EP site, Idenity must be the supplied Business Connector Proxy account that was setup in the Dynamics AX form. In our example, we have a standard Application pool. [Because we assume a single site for the IIS, for simple implementation of our custom site.] Since this is the case, then the First person to logon to the custom site can be used as the Business Connector Proxy account, and then all other user connection coming in with use the BC Proxy account, as long as that user account is active and does not time out. If that account does, then the next person to logon will assume the BC proxy account. You can see this in the Online users form. Admin > Online Users.

To achieve this, 2 things must happen. (1) The users using this application must have rights to logon as Business Proxy Account. (2) In your connection code you must make use of a Network credenitals object, and use the LogonAs() method. Let take a look at some sample connection code below:

Example Connection Code:

// Declartions
public Axapta objDAXCn;
System.Net.NetworkCredential nc;

// Make use of Declartions
nc = new System.Net.NetworkCredential(UserId, passwd, NetworkDomain);
objDAXCn = new Axapta();
objDAXCn.LogonAs(userId, NetworkDomain, nc, StartCompany, "", FQAOSInstance, "");
objDAXCn.Refresh();

Session["objDAXCn"] = objDAXCn;

Now lets take and break this down. First we have the declartions. We declar for an Axapta object, and then a NetworkCredential object. These are used as part of forming our connection for the given ASP.net session. Next we take and declare new for the given nc variable and then set it equal to passed in variables. Could be from a login scsreen. The nc is set then, and we move to setting the Connection object [Axapta] to a new instance. Next we perform the .LogonAs() [And not .Logon()] with passing the:

1. userId - From the passed in login screen
2. NetworkDomain - possible Global.asax global variable
3. nc - The given network credentials that will be used for the .Net BC Proxy account. [Unless a session already exists for the instance, then the existing BC Account is made use of]
4. StartCompany - What Dynamics AX company to start in
5. ""
6. FQAOSInstance - The Full name of the Dynamics AX instance. Example: "instanceName@ServerName:PortNumber"
7. ""

After this we perform a refresh and then set a session variable equal to the Open connection so it can be reused throughout the Site session for the given user. [performance helper].

So that is a good breakdown and coverage of making a connection via the .Net BC. YOu can get fancy with this for pooling, multiple Application Pools, single sessions, shared sessions, etc. etc. For now this will give you what you need, and your application should drive you to be as complex, Only as it needs to be. [Always use KISS method]

Well check back as we continue down this path!

Find a job at: www.DynamicsAXJobs.comFind a job at: DynamicsAXJobs.com, also post a job for only $99.00!


==============
Источник: http://dynamics-ax.blogspot.com/2007...step-back.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Dynamics AX: .Net BC Custom App, Advanced Connection Talk Blog bot DAX Blogs 0 09.06.2007 00:27
Dynamics AX: .Net BC Custom App, Part III - Container Object Blog bot DAX Blogs 0 06.06.2007 22:11
Dynamics AX: .Net BC Custom App, Part II Blog bot DAX Blogs 0 06.06.2007 10:07
Dynamics AX: ASP.Net and the Dynamics AX .net BC Blog bot DAX Blogs 0 05.06.2007 02:28

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 09:12.