This blog is usually a place for answers, but today I have a web service question that has stumped me and the experts I’ve consulted thus far. Here is my challenge:
When a client connects to a C# web service, how can it bind to a specific DLL in the web service “bin” folder?
The gritty details… I have a shared assembly (shared.dll) that is referenced both by a C# WinForms client (client.exe) and a C# Web Service (service.dll).
When I upload the service to the Web, naturally both service.dll and shared.dll are uploaded to the “bin” folder. Defined in service.dll is a class called “DataService” that provides the web service methods I need. To access this web service, client.exe uses code in shared.dll to construct and use a DataService object. Therefore, the following proxy class is generated in Reference.cs for shared.dll:
public partial class DataService :
System.Web.Services.Protocols.SoapHttpClientProtocol
The problem occurs when I attempt to execute a method on the DataService object from client.exe. It throws the following exception:
The type ‘MyNamespace.DataService’ is ambiguous:
it could come from assembly ‘binservice.dll’
or from assembly ‘binshared.dll’.
Please specify the assembly explicitly in the type name.
I understand the ambiguity. There is the proxy definition for DataService in shared.dll (that inherits from SoapHttpClientProtocol). Then there’s the full class definition of DataService in service.dll. The web service doesn’t know which to choose and throws an exception.
My question is, how can I resolve this ambiguity? How do I explicitly tell the web service to use the DataService definition in service.dll? The DataService.asmx file only has a Class attribute, but nowhere to specify a specific assembly.
After conversing with Microsoft tech support and a couple of MVPs, it appears there is currently no way for a C# web servce client to bind to a specific DLL in the web service “bin” folder.
Thus, the solution is to re-architect the project. I removed the proxy definition for DataService (that inherits from SoapHttpClientProtocol) from shared.dll, and moved it into a separate client.dll. My application client.exe references client.dll, and since client.dll is not uploaded to the web services “bin” folder, there is no ambiguity.
Exactly what happened on my part. I have resolved mine by serializing changing the parameter of the method in my webservice from object to string and serialize it. it’s true it’s ambigous coz the service and the UI both use the datamodel entity (on my part).
so from:
[WebMethod]
public string GetContact(ContactList contactList)
to:
[WebMethod]
public string GetContact(string contactList)
and from the calling UI, i serialiaze the object to string and inside the webmethods, deserialize it! And you’re done!
I would think that if you ran Counter strike through a Proxy, you would get booted for lag. If you’ve been kicked out of their servers, they are probably using your computer Id which you can’t change and you would still not be able to get in.