web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

.NET Business Connector works on one machine, but not entirely on another to 2012

(0) ShareShare
ReportReport
Posted on by

I have two different web servers hosting ASP.NET 4.x web applications that connect to an AX 2012 R2 instance using the .NET Business Connector. On server A, all functionality works: read, update, etc. On server B, using the exact same piece of code, most functionality works. However, one call to update a custom field in an existing record of SalesLine fails. Being Business Connector, I only get a generic error of on the ASP.NET webserver:

Exception of type 'Microsoft.Dynamics.AX.ManagedInterop.ErrorException' was thrown.
at Microsoft.Dynamics.BusinessConnectorNet.AxaptaRecord.Update()

The AOS server records NO errors for the failed call that we can find in Event Viewer. There's a bunch of validation logic on the update. When called from server A, it succeeds and completes the update after an average of 40-45 seconds. When called from server B, it fails after an average of 20-25 seconds. 

I have verified that the code being used and the business connector DLL files on both servers are the exact same. Configuration for both servers also appears to be identical. Further, all other functions from server B work just fine. I can read and update various tables and fields. Just this one function is causing problems, and only from one of the two servers.

Here's the code:

Axapta axp = new Axapta();
if(axp.Login()){
AxaptaRecord lineToModify = axp.CallStaticRecordMethod(
"SalesLine", "findRecId", saleslineid, true) as AxaptaRecord;

axp.TTSBegin();
lineToModify.set_Field("CustomFieldName", customFieldNewValue);
lineToModify.Update();            çFAILS ON THIS COMMAND
axp.TTSCommit();
lineToModify.Dispose();
axp.Logoff();
axp.Dispose();
}

Completely baffled and not sure where else to look to try and troubleshoot.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi BBlake,

    Not exactly sure, but could it be related to a time-out setting which might be different on both servers? 40-45 seconds for an update is very long.

  • Community Member Profile Picture
    on at

    Can't disagree on the time, but I didn't write the function. However, I am not sure where to look for additional timeout settings. Is there something in the business connector config that I'm missing? I have verified that the ASP.NET app timeouts and IIS timeout are all much greater than that. And 20-25 seconds seems an odd timeout setting regardless.

  • Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    Did you check properties of ErrorException, such as Message and StackTrace?

    Have you tried to debug code inside Update()?

  • Community Member Profile Picture
    on at

    The only thing in the stack trace is what I posted above, no inner exceptions on the .NET side. My AX guy has been looking at the AX function, but since it works from one machine, but not another, he thinks it's related to the business connector. The problem is nothing changed on the two web servers over the weekend. No updates, no code changes, no patches. The only thing that changed was a deployment update in AX. But that still doesn't explain really why it works from one web server, but not the other.

  • Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    I would still recommend doing both things - checking the Message property and trying to debug code. Even if you believe that it fails before actually reaching application code, you can't be sure unless you test the assumption.

    By the way, do both servers use the same user account and did you test the behavior with the same data (same company, same sales line, same value)? If not, it's easy to imagine that the different context (permissions, data) cause different behavior.

  • Community Member Profile Picture
    on at

    Yes, both servers using the same account to login and trying to hit the same company, sales line and values, which is the frustrating part. My first guess would have been some kind of permissions problem, but everything is all the same between the two. Still delving into debugging on the .NET and AX sides both and trying to extract a better error message in either place. We're also going to try reinstalling the BC on the failing server.

    This is perhaps the weirdest issue I've run into in 20 years of development.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi BBlake,

    Does an update to salesLine always fails on server B? Do you have only one AOS or serveral? If several do you use load balancer?

  • Community Member Profile Picture
    on at

    Yes, always fails on B. There's only one AOS and no load balancer.

    Additional update: I created a small console app with only that function code in it to call that update. And it worked fine. I have tried swapping out the DLL files (32 bit versions vs 64 bit versions of businessconnector and interop) and the result is still the same. The call fails from the web app.

  • Community Member Profile Picture
    on at

    Update to clarify: The console app, running from the command line by itself, succeeded in updating the data. The DLL version swapped I tried in the ASP.NET app without luck. So next I tweaked the console app so I could pass in parameters and tried calling it from the asp.net app using Process.Start. It failed so far, but I'm going to try a couple other tweaks to that scenario to see if I can get something to work.  

  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi BBlake,

    Just a follow up to see if you succeeded solving your issue. Can you update us on your latest 'other tweaks'?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans