开发者

Adding Service Reference in Visual Studio 2010 problem

开发者 https://www.devze.com 2023-02-07 09:11 出处:网络
I\'m trying to use Visual Studio 2010 to Add Service Reference to a service that I do not own.It does not add anything to the app.config, and the Reference.cs file that gets created only contains two

I'm trying to use Visual Studio 2010 to Add Service Reference to a service that I do not own. It does not add anything to the app.config, and the Reference.cs file that gets created only contains two classes, viz SerializableExpression and an empty InterLinqType class. But I don't have a usable client that I can instantiat开发者_StackOverflow社区e. When I turn off the option to Reuse Types in generated assemblies then it generates a bit more members in the above-mentioned classes, but still I have no usable client class that I can instantiate as my proxy to the service! Using Visual Studio 2008 to add a Service Reference to the same service all works perfectly! Please help.


I've had this issue in the past working with a 3rd party service.

3 things to try.

  1. Download the WSDL locally and try to add it from there.
  2. Create the proxy from the command line and then add it to your project. Here is more info on the command line util: http://msdn.microsoft.com/en-us/library/aa347733.aspx Play around with the flags that are available. Keep an eye on the /targetClientVersion flag. Here is a sample usage:

    svcutil /t:code /language=VB http://servicedomain/serviceurl /out:MyServiceProxy.vb /config:MyServiceProxy.config

  3. Validate the WSDL you are looking at is actually valid. I've had invalidate characters, unclosed tags, and invalid locations of extra dtd files throw off the creation of proxies. You can try and use the validator here to see if it fails here: http://xmethods.net/ve2/Tools.po


This is an old post but thought I would added my two cents on my solution.

I had the same issues as well. What I discovered is that my assembly references where not set correctly.

Issue: My test container is referencing my service reference and was only displaying my contracts not my service methods.

Resolution: I was referencing the assembly that contained my contracts. Once I removed it the references reappeared. Then I became curious and wondered if I could reference that assembly if needed without loosing my service reference. So, I readded that assembly I had removed in my references and then right clicked on the service reference and selected, "Configure Service Reference". I chose "Reuse types in specified referenced assemblies" and then only selected the system assemblies - i.e. did not select the assembly that is used in my service and referencted in my test - the only I originally removed to fix the issue. Every thing worked.

Summary: you have to play with the references a bit. This is how I fixed the issue in my project.

0

精彩评论

暂无评论...
验证码 换一张
取 消