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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
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);
    }

I have the same question (0)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 46

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 28 Super User 2026 Season 1

#3
sannavajjala87 Profile Picture

sannavajjala87 25

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans