VB Magic

2013/01/09

Cannot import wsdl:portType error when adding a service reference

Filed under: .NET — Tags: , , , — vbmagic @ 1:25 pm

I came across this problem over the holiday period. The full error was:

Warning    4    Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='Ixxxxx']    C:\projects\Tyrannt RPG\Tyrannt\Tyrannt.Client.Web\Service References\CodexUpdateServiceReference\Reference.svcmap    1    1    Tyrannt.Client.Web

After doing a bit of searching I found the way to fix it was to remove the Newtonsoft.Json.Linq.JToken from the “Resue Types”:

Right click the service reference…

Service Reference

Select the Reuse Types in Selected References option and tick all the boxes except the Newtonsoft.Json package.

This was the blogpost that helped me solve it “Type ‘Newtonsoft.Json.Linq.JToken’ is a recursive collection data contract” While Adding Service Reference in VS2012

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: