views:

584

answers:

1

Currently I'm looking at a problem with web references in vs2005 .net

I have multiple web applications with multiple dynamic web references, now in the web.config I see the following code:

<applicationSettings>
    <MainWeb.Properties.Settings>
        <setting name="MainWeb_localhost_WebService" serializeAs="String">
            <value>http://localhost/test/WebService.asmx&lt;/value&gt;
        </setting>
    </MainWeb.Properties.Settings>
</applicationSettings>

But because I'm using the same web services in different applications I want the place the web reference in the machine.config, but As you can see, the name of the web reference is diverted from the web application name, so the name is not dynamic at all.

And I don't want to put 10 different web references in the machine.config for the same web service.

So now is my question if someone know a good solution/workaround for this isseu.

+2  A: 

If you use wsdl.exe at the command line, you can pick the key with the /appsettingurlkey:<key> switch. The MainWeb_localhost_WebService is just what the IDE chooses as a default; that way, you can use the same key from multiple apps.

In this scenario, it sounds like you might also want to create an assembly that purely represents the web-service (that all your web-applications reference); this will properly represent the fact that they represent the same essential service.

Marc Gravell