Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error the value could not be added to the collection on a web service

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, I´m using VS 2016, I have this error:

2388.1.jpg

this is the code:

3107.2.jpg

The error comes out reaching this part: IOrganizationService service = (IOrganizationService)osProxy;

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error the value could not be added to the collection on a web service

    You´re right, I´ve commented the line of ProxyTypesBehavior and the program works!

    Thanks.

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Error the value could not be added to the collection on a web service

    Hi Jhon,

    Is the error on the osProxy.Service.Configuration.CurrentServiceEndpoint.Behaviors.Add line or on the service = (IOrganizationService)oxProxy line?

    Can you check before the osProxy.Service.Configuration.CurrentServiceEndpoint.Behaviors.Add line if osProxy.Service.Configuration.CurrentServiceEndpoint.Behaviors has any values in it already?

    You might not need it, or possibly check if it has values before calling the Add method of the class.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans