Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

The remote server returned an error:(404) Not Found.

Posted on by Microsoft Employee

I am creating xml object of particular entity record and send to the server.

The code was working fine till yesterday.

Now, i am not able to send the data most of time and getting following error.

0572.error.png

   

*This post is locked for comments

  • Verified answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: The remote server returned an error:(404) Not Found.

    Hi Pawan,

    Your exception is completely clear, 404 Not Found ==> your endpoint not exists (or your server not reachable).

    Can you open your endpoint url with browser or outside your plugin codes (such as console app).

    Other important point, you can not use IP address to call any webservice inside plugin / workflow assembly, D365 doesn't allow this, use domain / subdomain

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: The remote server returned an error:(404) Not Found.

    Thanks for reply,
    I am working on Dynamics 365 Online.

    I able to hit my service through the plugin.

    but Service endpoint throw  exception 


    Plugin code:

    WebClient webClient = new WebClient();
    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(string));
    MemoryStream mem = new MemoryStream();
    ser.WriteObject(mem, order);
    string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
    webClient.Headers["Content-type"] = "application/json";
    webClient.Encoding = Encoding.UTF8;
    serres = webClient.UploadString("xxxxxxxxxxxxxxx/.../PlaceOrder", "POST", data);


    Service Code:
    public string PlaceOrder(string order)
            {
    
                try
                {
                    counter++;
                    HttpWebRequest request = null;
                    string destinationUrl = "api endpoint";
    
                    request = (HttpWebRequest)WebRequest.Create(destinationUrl);
                    byte[] bytes;
                    bytes = System.Text.Encoding.ASCII.GetBytes(order);
                    request.ContentType = "application/xml; encoding='utf-8'";
                    request.ContentLength = bytes.Length;
                    request.Method = "POST";
                    Stream requestStream = request.GetRequestStream();
                    requestStream.Write(bytes, 0, bytes.Length);
                    requestStream.Close();
                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            Stream responseStream = response.GetResponseStream();
                            string responseStr = new StreamReader(responseStream).ReadToEnd();
                            order = responseStr;                        
                           
                        }
                        else
                        {
                            order = response.ToString();
                        }
                    }
    
                    return order;
                }
                catch (Exception exp)
                {                
                    return exp.Message.ToString();
                }
                
            }



  • MSCRM Guru Profile Picture
    MSCRM Guru 600 on at
    RE: The remote server returned an error:(404) Not Found.

    Hey,

    Can you share the code? Hard to help with little to go on...  Is this in Dynamics 365 Online or some version of OnPrem?

    Good luck!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans