Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

Dynamic URL Failure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WhiskyRomeo - 25 Feb 2005 16:49 GMT
I have an solution with several projects which call a web service for the
data retrieval and updates.

The main program is called DMS.exe.  When I configure the webservice to use
Dynamic URL and create entries in the app.config file of the following
format, the application can't find the webservice.  Static works fine but I
have to set the url in code in every place a webservice is used.

<appSettings>
  <add key="myApplication.myServer.Service1"
       value="http://myServer/myXmlWebService/Service1.asmx"/>
</appSettings>

So given:

application name is DMS,
the web service project is called DMSDataWS,
the server is LASER,
the physcial path on the server is:\InetPub\wwwroot\DMSDataWS\wsCommon.asmx,
the virtual folder is named DMSDATAWS (under DefaultWebSite)
the service is name wsCommon.asmx

What should the entry look like?  The following does not work.

<appSettings>
  <add key="DMS.Laser.wsCommon.asmx"  
value="http://LASER/DMSDATA/wsCommon.asmx"/>
</appSettings>

Signature

wr

Dan Rogers - 08 Mar 2005 00:47 GMT
You should set the URL setting to be the URL of the service asmx entry
point.  So if it is on a server named laser, it would start with
http://laser/....

Try debugging your application - are you sure you are getting the string in
your config file correctly and then using that to set the proxy URL
setting?  You really only have to do this at the place you create your
proxy each time.  If you can use a local string resource with the right URL
and that works, you can prove whether or not the string you need is coming
from the config file.

Something to be careful of is the \ character - make sure that you account
for it as the escape operator in any local strings (so you would have
"http:\\\\laser\\foo.asmx"

--------------------
>Thread-Topic: Dynamic URL Failure
>thread-index: AcUbWjBNICQRk6LrSNKJqbCFhha7zQ==
>X-WBNR-Posting-Host: 65.27.6.160
>From: "=?Utf-8?B?V2hpc2t5Um9tZW8=?="
<WhiskyRomeo@discussions.microsoft.com>
>Subject: Dynamic URL Failure
>Date: Fri, 25 Feb 2005 08:51:02 -0800
[quoted text clipped - 13 lines]
>Path: TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:28301
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 26 lines]
>value="http://LASER/DMSDATA/wsCommon.asmx"/>
></appSettings>
WhiskyRomeo - 08 Mar 2005 15:23 GMT
Thanks for the reply . . .

When debugging it is obvious the URL did not come from the config file.  But
what I don't know is  -- did it fail because it couldn't find the key it was
looking for or what?

So my question remains what does the key look like so the lookup will
suceed? The URL I am using is correct because when I use the static mode, it
works correctly.

I can move it to the production server and set the URL each time I form the
proxy and it works fine.  However, I don't want to have to go through code
and change it  everytime I deploy to a different server.

I have another way to accomplish this, by I don't understand what is failing
with they dynamic URL route.

WR

> You should set the URL setting to be the URL of the service asmx entry
> point.  So if it is on a server named laser, it would start with
[quoted text clipped - 68 lines]
> >value="http://LASER/DMSDATA/wsCommon.asmx"/>
> ></appSettings>
Dan Rogers - 08 Mar 2005 20:42 GMT
I think the problem is going to be in the code you use to get your
appsettings.  If you don't specify a match on key name, you won't get the
data you want.  What I'm suggesting is you debug your logic with
breakpoints so you can see what and when (or if) your code that gets the
appsettings is even accessed.  You do have code that asks for the specific
app-setting don't you?  There is no automatic app setting mapping done for
you to get a connection string.

--------------------
>Thread-Topic: Dynamic URL Failure
>thread-index: AcUj8rmKH5JcQEuXQaOmN2jbeWIMtQ==
>X-WBNR-Posting-Host: 65.27.6.160
>From: "=?Utf-8?B?V2hpc2t5Um9tZW8=?="
<WhiskyRomeo@discussions.microsoft.com>
>References:  <CE83AEF7-F278-4481-9F1D-CAEFCB2A68ED@microsoft.com>
<88Kpgh3IFHA.2176@TK2MSFTNGXA02.phx.gbl>
>Subject: RE: Dynamic URL Failure
>Date: Tue, 8 Mar 2005 07:23:05 -0800
[quoted text clipped - 13 lines]
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:28492
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 89 lines]
>> >value="http://LASER/DMSDATA/wsCommon.asmx"/>
>> ></appSettings>
WhiskyRomeo - 08 Mar 2005 21:15 GMT
The article on which I am basing my question is:

Redirecting an Application to Target a Different XML Web Service During
Installation

I found it by searching VS Help using "Dynamic URL."

This article implies  -- simply putting a key:value entry in the appconfig
file of the form I listed in my original question and changing the URL
Behaviour to Dynamic is all that is needed.  They go on to specify a custom
installer class, so that a user can input the name of the server and service.
This used to modify the key:value entry in the appconfig during
installation.  I am not doing this, I am simply modifying the appconfig file
before generating the install files.

In otherwords, when the URL Behaviour is Dynamic, the application knows to
look in the appconfig for the key --> MyWebApp.localhost.Service1

In this case, there is no other code at runtime being used to access the
appconfig file to set the URL.

> I think the problem is going to be in the code you use to get your
> appsettings.  If you don't specify a match on key name, you won't get the
[quoted text clipped - 134 lines]
> >> >value="http://LASER/DMSDATA/wsCommon.asmx"/>
> >> ></appSettings>
Dan Rogers - 09 Mar 2005 20:19 GMT
Ahh.

You're right.  When you change the URL behavior property from Static to
Dynamic, you'll find that the setting gets made for you automatically in
the appsettings section of your config file.  The pattern for the key is
ProjectNamespace.ProxyNamespace.ServiceClassname.

You should be able to look in your myapplicationexename.config file and see
this setting.  If you put this in a different file, it could explain the
issue.

SO where you have

>> >> ><appSettings>
>> >> >   <add key="myApplication.myServer.Service1"
>> >> >        value="http://myServer/myXmlWebService/Service1.asmx"/>
>> >> ></appSettings>

In your example:
>> >> ><appSettings>
>> >> >   <add key="DMS.Laser.wsCommon.asmx"  
>> >> >value="http://LASER/DMSDATA/wsCommon.asmx"/>
>> >> ></appSettings>

You have an extra .asmx in the key name.  This could be the problem.

this means your applications namespace is myApplication, your proxy
namespace is "myServer", and the name of the service class is Service1.

--------------------
>Thread-Topic: Dynamic URL Failure
>thread-index: AcUkI+aYz8xNpjy3QNOfIYz/9YKiyQ==
>X-WBNR-Posting-Host: 65.27.6.160
>From: "=?Utf-8?B?V2hpc2t5Um9tZW8=?="
<WhiskyRomeo@discussions.microsoft.com>
>References:  <CE83AEF7-F278-4481-9F1D-CAEFCB2A68ED@microsoft.com>
<88Kpgh3IFHA.2176@TK2MSFTNGXA02.phx.gbl>
<B0408286-35C0-4134-8AAC-5CABAB6C0C4F@microsoft.com>
<9V6mb9BJFHA.2156@TK2MSFTNGXA02.phx.gbl>
>Subject: RE: Dynamic URL Failure
>Date: Tue, 8 Mar 2005 13:15:06 -0800
[quoted text clipped - 13 lines]
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:28513
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 157 lines]
>> >> >value="http://LASER/DMSDATA/wsCommon.asmx"/>
>> >> ></appSettings>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.