What does this WCF error mean: “Custom tool warning: Cannot import wsdl:portType”

后端 未结 13 1811
难免孤独
难免孤独 2020-11-29 17:38

I created a WCF service library project in my solution, and have service references to this. I use the services from a class library, so I have references from my WPF applic

相关标签:
13条回答
  • 2020-11-29 18:16

    that might sound weird, but I got it fixed by deleting the references, then closing Visual Studio, and reopening it again, and finally adding the references again.

    I think the custom tool thing needed to be restarted or something.

    0 讨论(0)
  • 2020-11-29 18:16

    One downside of turning off 'reuse types in referenced assemblies' is that it can cause issues with ambiguous references. This is due to the service reference creating those objects again in the reference .cs file, and your code implementing the service may be referencing them from the original namespace.

    When this scenario occurs I find it useful to check the 'reuse types in specified referenced assemblies' which allows me to choose the ones with ambiguous references only, which resolves the issue quickly that way.

    Hope it helps someone else.

    0 讨论(0)
  • 2020-11-29 18:18

    Go to Advanced properties while adding reference and remove "System.Window.Browser" from the checklist, It solves the problem.

    0 讨论(0)
  • 2020-11-29 18:19

    I found my answer here: http://www.lukepuplett.com/2010/07/note-to-self-don-let-wcf-svcutil-reuse.html

    Long story short: I unchecked Reuse types in reference assemblies from the Advanced menu.


    I don't know if this matters but i'm not using MVC, but Web Forms.

    0 讨论(0)
  • 2020-11-29 18:21

    I got the warning after upgrading my solution from Visual Studio (VS) 2010 to 2013 and changing each project's .NET Framework from 4 to 4.5.1. I closed VS and re-opened and the warnings went away.

    0 讨论(0)
  • 2020-11-29 18:23

    When you add a service reference, there are two ways the types that are used by the service can be handled:

    • The types are stored in a dll, and that dll is referenced from both the client and the server application.
    • The types are not in a dll referenced by the client. In that case the tool that creates the service reference, will create the types in the references.cs file.

    There are many things that can go wrong. We have found that if the tool crashes, it is sometimes faster to delete the service reference and start again.

    We have stopped using service reference. For projects where we have control of the client and the service, we use the method described in this screencast.

    0 讨论(0)
提交回复
热议问题