Ambiguous compile-time runtime error

I recently added some namespaces to my web.config file so that all my aspx pages can reference different constants and enumerations without having to add an import statement to every aspx page. Since we add this, we get an error when trying to check the asmx web service. It seems that during the generation of wsdl we get the following error:

CS0104: "Message" is an ambiguous link between 'System.Web.Services.Description.Message' and 'InsTech.ForeSight.Message'

During the research, I found out that DefaultWsdlHelpGenerator.asmx is called at compile time at runtime, and there is a method there that has the following signature:

void WriteSoapMessage(MessageBinding messageBinding, Message message, bool soap12) {

We have an object defined in our namespace called Message that invokes an ambiguous link because this web service file does not fully select its message.

How can I solve the problem without removing namespaces from web.config? We have our web services in a different folder in our virtual directory, so I tried to add a web.config file that clarified the namespace, but this does not seem to work.

Any help would be greatly appreciated. thanks kevin

+5
source share
1 answer

You can use namespace aliases in your code and use them to distinguish between them:

using ourOwn=our.own.namespace;

And refer to your message class as ourOwn.Message. This will avoid a collision.

+3

All Articles