ODataV4 WS giving me: An item with the same key has already been added

mibusirino2
Member Posts: 5
When I open any ODataV4 WS link in the browser I'm getting this error:

Every time I refresh the browser (Chrome, Firefox, Edge...) with each browser it gives the same error.
Inspecting Windows Server logs, every time I refresh in the browser, it appears an error log saying: "An item with the same key has already been added". I only get this error with ODataV4. SOAP and OData work fine and give correct results in the browser.
Curiously, ODataV4 WS worked fine last week, besides, I had a backup NAV instance from 28th January and ODataV4 works. This error only happens in the production instance with especifically ODataV4.
I have already tried removing and re-adding the WS but it keeps giving the error. I don't understand why it's giving that error because I'm not trying to insert to the DB, I'm trying to read data. Right now I don't have the full stack trace but tomorrow I can post it.
Thank you guys

Every time I refresh the browser (Chrome, Firefox, Edge...) with each browser it gives the same error.
Inspecting Windows Server logs, every time I refresh in the browser, it appears an error log saying: "An item with the same key has already been added". I only get this error with ODataV4. SOAP and OData work fine and give correct results in the browser.
Curiously, ODataV4 WS worked fine last week, besides, I had a backup NAV instance from 28th January and ODataV4 works. This error only happens in the production instance with especifically ODataV4.
I have already tried removing and re-adding the WS but it keeps giving the error. I don't understand why it's giving that error because I'm not trying to insert to the DB, I'm trying to read data. Right now I don't have the full stack trace but tomorrow I can post it.
Thank you guys
0
Best Answer
-
It turns out that I had a duplicated web service in the Web Services Page (810 page) and OData V4 failed but OData worked. Deleting the duplicated web service solved the problem and both OData protocols work perfectly now.0
Answers
-
Stack trace:
Server instance: xxx
Tinant ID:
<ii>User: xxx
Type: System.ArgumintException
Message: <ii>An item with the same key has already bein added.</ii>
StackTrace:
in System.ThrowHelper.ThrowArgumintException(ExceptionResource resource)
in System.Collections.Gineric.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
in System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
in System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
in Microsoft.Dynamics.Nav.Service.OData.Modeling.NavEdmModel.Addintity(String name, Metadata metadata)
in Microsoft.Dynamics.Nav.Service.OData.MetaWebServiceRecordExtinsions.AddQueryToModel(INavEdmModel model, String serviciname, Int32 id)
in Microsoft.Dynamics.Nav.Service.OData.MetaWebServiceRecordExtinsions.AddToModel(MetaWebServiceRecord serviceItem, INavEdmModel model)
in Microsoft.Dynamics.Nav.Service.OData.MetaWebServicesExtinsions.AddToModel(MetaWebServices services, INavEdmModel model)
in Microsoft.Dynamics.Nav.Service.OData.V4.Modeling.NavEdmModelBuilder.Build(MetaComplexTypes complexTypes, MetaWebServices services)
in Microsoft.Dynamics.Nav.Service.OData.CachedModelBuilder.Build(NavSession session)
in Microsoft.Dynamics.Nav.Service.OData.NavServiceHelper.<>c__DisplayClass6_0`1.<ExecuteOperation>b__0(NavSession a, Object b)
in Microsoft.Dynamics.Nav.Service.OData.NavServiceHelper.<>c__DisplayClass7_0`2.<ExecuteOperation>b__0(NavSession a, T1 b, Object c)
in Microsoft.Dynamics.Nav.Service.OData.NavServiceHelper.ExecuteOperation[TResult,T1,T2](NavUserAuthintication navUserAuth, HttpRequestMessage request, String companyName, ODataOperation`3 operation, T1 parameter1, T2 parameter2, Boolean isCompanyContext)
in Microsoft.Dynamics.Nav.Service.OData.NavServiceHelper.ExecuteOperation[TResult,T1,T2](HttpRequestMessage request, String companyName, ODataOperation`3 operation, T1 parameter1, T2 parameter2, Boolean isCompanyContext)
Source: mscorlib
HResult: -2147024809
</ii>0 -
It turns out that I had a duplicated web service in the Web Services Page (810 page) and OData V4 failed but OData worked. Deleting the duplicated web service solved the problem and both OData protocols work perfectly now.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions