473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Type is ambiguous. Please specify the assembly explicitly...

I have an odd web services problem.

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 web service, naturally both service.dll and shared.dll are
uploaded to the bin folder.

In service.dll is defined 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 partial class is generated in Reference.cs for shared.dll:

public partial class DataService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol

The problem occurs when I attempt to execute a method on the DataService
object from client.exe. It produces the following error:

The type 'MyNamespace.DataService' is ambiguous:
it could come from assembly '\bin\service.dll'
or from assembly '\bin\shared.dll'.
Please specify the assembly explicitly in the type name.

I can understand the ambiguity. There is the partial definition for
DataService that inherits from SoapHttpClientProtocol in shared.dll, and then
there's the full definition of DataService in service.dll.

The question is, how can I resolve this ambiguity? How do I explicitly tell
client.exe to use the full DataService definition in service.dll, and NOT the
partial definition in shared.dll?

Thank you.
Jan 10 '08 #1
2 3879
TRY

Type.GetType("TopNamespace.SubNameSpace.Containing Class+NestedClass,
MyAssembly");

--
Misbah Arefin

"Mini-Tools Timm" wrote:
I have an odd web services problem.

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 web service, naturally both service.dll and shared.dll are
uploaded to the bin folder.

In service.dll is defined 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 partial class is generated in Reference.cs for shared.dll:

public partial class DataService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol

The problem occurs when I attempt to execute a method on the DataService
object from client.exe. It produces the following error:

The type 'MyNamespace.DataService' is ambiguous:
it could come from assembly '\bin\service.dll'
or from assembly '\bin\shared.dll'.
Please specify the assembly explicitly in the type name.

I can understand the ambiguity. There is the partial definition for
DataService that inherits from SoapHttpClientProtocol in shared.dll, and then
there's the full definition of DataService in service.dll.

The question is, how can I resolve this ambiguity? How do I explicitly tell
client.exe to use the full DataService definition in service.dll, and NOT the
partial definition in shared.dll?

Thank you.
Jan 17 '08 #2
Misbah, thank you for your response. The problem is that both the proxy
(which derives from SoapHttpClientProtocol) and the full class by definition
have the same namespace+type. I have tried to explicitly rename the proxy
type and also tried moving it to another namespace, but in both cases another
exception is thrown indicating that the web service does not support
partially trusted types.

Jan 17 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom | last post by:
Given a path to an assembly in unmanaged code does anyone know of a way to load the assembly and enumerate out the types as strings using the mscorlib API? Thanks in advance Tom
2
by: John Smith | last post by:
I have created an assembly that needs to load types from other assemblies on-the-fly. However, if I use the Assembly.Load() method it tells me it cannot find the assembly that I requested. I assume...
2
by: Abdessamad Belangour | last post by:
Hi all, within the same assembly, we are capable to retrieve the superTypes of a given Type object by using the IsSubclassOf method of the Type class. What about classes that belongs to external...
4
by: Spike | last post by:
i know its possible to load an assembly and create instances of the types contained however is it possible to do this withough calling the assembly.createinstance method? but using the Activator...
0
by: Andrew Venmore | last post by:
Hello, I am having a problem adding an assembly to the toolbox where it appears VS2003 is unable to make sense of a type I am trying to initialise an attribute with. Below is the simplest...
2
by: David Williams | last post by:
We are getting this error after clearing the web.config of database infomation - even after using the wizard to re-enter the information. I could find nothing (other than one other person asking...
1
by: Lucky | last post by:
hi guys, i got an error while i was migrating one of the webproject developed in 1.1 to 2.0. i got error in one dll reference in global.asax. it says "The type 'Ims.Tmpc.Global' is...
0
by: Bakunin | last post by:
Hi, I have a quick question regarding getting type infrmation from an assembly. I want to be able to validate XML objects as part of my web service solution. I do the following: 1. I have my...
1
by: DiamonDogX | last post by:
I have created a project of type "AST.NET Web Service" in Visual Studio 2005. When I run it on my box, (i.e. click the green debug button), it launches Internet Explorer and shows the available web...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.