473,839 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
+ 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.Serv ices.Protocols. SoapHttpClientP rotocol

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.Da taService' is ambiguous:
it could come from assembly '\bin\service.d ll'
or from assembly '\bin\shared.dl l'.
Please specify the assembly explicitly in the type name.

I can understand the ambiguity. There is the partial definition for
DataService that inherits from SoapHttpClientP rotocol 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 3920
TRY

Type.GetType("T opNamespace.Sub NameSpace.Conta iningClass+Nest edClass,
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.Serv ices.Protocols. SoapHttpClientP rotocol

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.Da taService' is ambiguous:
it could come from assembly '\bin\service.d ll'
or from assembly '\bin\shared.dl l'.
Please specify the assembly explicitly in the type name.

I can understand the ambiguity. There is the partial definition for
DataService that inherits from SoapHttpClientP rotocol 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 SoapHttpClientP rotocol) 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
1362
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
2136
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 this is because the assembly is not referenced in the project. So how do I load assemblies that are in my Visual Studio solution but are not referenced in the particular project? Thanks
2
1800
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 assemblies. Should i get the referenced assemblies (by there names), load them and then browse there types to find the superTypes of my given type ? Any help would be appreciated. Thanks.
4
347
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 class insted? so a reference to each assembly does not need to be maintained??
0
1150
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 example which demonstrates the problem. I have two class library projects in my solution: BaseLib and ControlLib. BaseLib declares a custom attribute and an enum, and ControlLib references BaseLib and has a toolbox class and uses the custom attribute.
2
1291
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 about it back in Nov) on google or MSDN. Any help would get great! TIA
1
6792
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 ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\tmpc\0645d1b5\4ea8c73e\App_Code.h0ihzjo3.DLL' or from assembly
0
922
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 schemas in a class library as embedded resources. 2. I load the assembly. 3. I call the GetManifestResourceStream method to get the schema I want. 4. I create a text reader with the stream and use this as a parameter for the XMLSchema.Read static...
1
2009
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 service functions, as expected. However, when I move the solution file to another box and click debug, visual studio gives me a message along the lines of: "Please specify the name of the executable file to be used for the debug session." Why is...
0
9697
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10648
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10293
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7017
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4484
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 we have to send another system
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3134
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.