Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Error in calling a dynamics 365 API from an internal website's webservice

(0) ShareShare
ReportReport
Posted on by 30

Hello, 

We came across an issue when calling the Dynamics 365 API from a webservice (which is our intranet http site). It works fine if it runs as an exe locally, but it fails when it is called from a web service via a dll. Please note, the code is exactly the same. We suspect it is a call for https while we are making a http request.  However, our https is open too. Do you have any suggestion on what we could do or do you have any idea why this happens? 

And here is the error.

The remote server returned an error: (500) Internal Server Error.

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---&gt; An error occurred while making the HTTP request to https://xxx.sandbox.operations.dynamics.com/soap/services/dmImgOurServiceGroup. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. ---&gt; The underlying connection was closed: An unexpected error occurred on a send. ---&gt; Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---&gt; An existing connection was forcibly closed by the remote host</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

 

And here is the source code:

 using (new OperationContextScope(Client365.InnerChannel))
    {
        string auth = "Bearer "   authToken;
        HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
        requestMessage.Headers["Authorization"] = auth;
        OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
        dtNow = DateTime.UtcNow;
        Client365.GetLog(c, qc, out Log365);
    }

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans