Cannot import wsdl:portType

    General discussion

  •  Hello all,

    Any help gratefully received...

     I have a simple WCF service which is using LINQ-to-SQL to execute a SQL Server stored procedure which will return a result set.

     I can successfully browse the service.  I can also add the service reference to the Silverlight application.

    However when I do, the reference.svcmap contains no classes.  And the following warnings are generated:

    1 Custom tool warning: Cannot import wsdl:portType
      Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
      Error: Exception has been thrown by the target of an invocation.
      XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='svcPermissions']
    2 Custom tool warning: Cannot import wsdl:binding
      Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
      XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='svcPermissions']
      XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:binding[@name='CustomBinding_svcPermissions']
    3 Custom tool warning: Cannot import wsdl:port
      Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
      XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='']/wsdl:binding[@name='CustomBinding_svcPermissions']
      XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:service[@name='svcPermissions']/wsdl:port[@name='CustomBinding_svcPermissions']
    4 Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
    5 Custom tool warning: Exception has been thrown by the target of an invocation.


     My web.config contains the following service model:

                 <add name="silverlightFaults" type="Microsoft.Silverlight.Samples.SilverlightFaultBehavior, SilverlightFaultBehavior, Version=, Culture=neutral, PublicKeyToken=null"/>
              <behavior name="SilverlightFaultBehavior" />
        <behavior name="Resources.Web.svcPermissionsBehavior">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="true" />
        <binding name="customBinding0">
         <binaryMessageEncoding />
         <httpTransport />
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
       <service behaviorConfiguration="Resources.Web.svcPermissionsBehavior"
        <endpoint address="" behaviorConfiguration="SilverlightFaultBehavior" 
        binding="customBinding" bindingConfiguration="customBinding0"
         contract="Resources.Web.svcPermissions" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    Can anybody explain what is going wrong?

     Many thanks

    Wednesday, August 05, 2009 10:24 AM

All replies

  • Did you create the Silverlight project using the Blend 2 or Visual Studio? Seems there is an issue when the Silverlight project has been created by Blend 2. This is discussed in: HTH, Jamie
    Wednesday, August 05, 2009 1:57 PM
  • Hi Jamie,

    Thanks for your reply.  The silverlight project and associated web application were both created using Visual Studio 2008 sp1.

     So the problem does not appear to be caused by blend.

     Any other ideas?



    Thursday, August 06, 2009 6:46 AM
  •  I had encoutered a similar problem when i added the WCF service reference to a Silverlight projcet that was migrated from v 2.0 to v 3.0. Is it the same case for you?

    Monday, August 10, 2009 6:17 AM
  • Hi aniljos

     I first encountered this error when migrating an application from silverlight 2 to 3.

     However, I experimented with generating an entirely new Silverlight 3 application from scratch, and I had exactly the same problem.

     So I don't believe the migration process is the source of the error.


    Monday, August 10, 2009 6:59 AM
  • I have the identical problem here - adding a Silverlight enabled WCF service into the web app which is hosting my silverlight app.  Get a customBinding created in the web.config but am unable to add a reference with the same errors.

     Any ideas yet?

    Tuesday, August 18, 2009 8:11 AM
  • I was having the same problem.

    I was migrating a Silverlight 2 App into Silverlight 3.

    My application was having WCF Service references, when I was converting the project with the automatic conversion wizard, all was fine.

    When I try to compile my project same errors as describe up in this topic.

    The solution, for me, was to right click on the service reference, configure service reference, select Generic.List for collection type, uncheck the reuse types in reference assemblies and the compilation is succesfull.

    If someone has informations about this problem, I am interested.

    Thursday, August 27, 2009 10:37 AM
  • Thank you syl for the information.  I was totally confused why I was getting these errors and your solution solved it.

    Sunday, October 11, 2009 11:44 PM
  • Syl you are a lifesaver. I've been tackling this issue for 3 days now. Strange thing is that I work in a team environment and have the code version checked. Someone else can checkout the code and update references without issue, but when I did it would break the reference. I even tried copying the code off their machine and putting it on mine, to no avail. I went so far as completely formatting my computer and putting Win7 on my machine (from Vista), and it still didn't work. I will remain perplexed as to why it still works on someone else's machine and not mine.

     Either way, thank you for this tidbit, it works great!

    Thursday, October 22, 2009 9:41 AM
  • I had the same problem and tried the solution from Syl.  When I closed the dialog "Configure Service Reference," VS 2008 crashed.  Whe I restarted it, the changes recommended by Syl were gone, but it still worked fine.  If you have this problem, you might try just closing and restarting VS.

    Sunday, December 13, 2009 10:27 PM
  • Just give the account "Network Service" complete access to your Temp Directory (C:\Windows\Temp).
    Monday, April 12, 2010 1:05 PM
  • Hey Syl thanks a lot, I hab the same problem, but solved it with your solution.

    Still don't know the exact reason, but I could isolate the source. When I select "Reuse types in SPECIFIED referenced assemblies" and check them one by one until the error occours, it is an assemblie from Telerik. It's "Telerik.Windows.Controls.DataVisualization.

    Got no clue why this control does prevent Visual Studio from creatind the service reference. Propably they use wcf too?!?

    Would be interesting if someone else with this problem is also unsing Telerik Controls.


    Wednesday, July 21, 2010 10:33 AM
  • I had the same issue and the culprit was  "Telerik.Windows.Controls.DataVisualization".  When I removed the project reference to this it worked.

    Thursday, August 05, 2010 1:13 AM
  • I had the same issue and I was stumped for some time.  My issue was also a reference to a Telerik dll. 

    Friday, October 08, 2010 11:22 AM
  • Hi syl,

    Yor are right.I follow your step and solved my problem.It's troubled me for a long time.

    So thanks very much.And could you please tell me the reason? I want to know why in




    Monday, November 29, 2010 10:55 PM
  • This worked for me!! Thanks a lot!

    Wednesday, December 29, 2010 12:42 AM
  • This solved this problem for me too.

    Friday, April 01, 2011 5:44 AM
  • I fixed it following the directions from Syl, I then went and changed settings back and it was fine then. So if you want the correct settings it seems you can change them back after.

    Monday, October 08, 2012 4:18 AM
  • I got the same issue and I fix it according to the solution provided by Syl (Thanks to Syl!!) and now I may know what's the root cause of the issue -- Type name conflict: If we checked "Reuse types in SPECIFIED referenced assemblies" and in the referenced assemblies they have any type whose the name is replicated with any type that the WCF service exported, then we will get such an issue.

    Friday, August 23, 2013 7:07 AM
  • Selecting Generic.List is different story and ones choice. Unchecking "reuse types..." solves type conflicts and does the trick.


    Friday, December 26, 2014 8:19 PM