By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Deploying a Windows Forms App that uses Web Services.

P: n/a
A quick scan of the group did not immediately reveal an answer to my
questions so here goes.

First let me describe my app and then I'll ask the questions.

I am writing a Windows Forms App (not Web Forms) that serves as a thin
client to some web services. In other words, the Windows Forms app will be
installed on the client machines and that app will call web services that
are deployed on my server.

In the process of developing the Windows Forms app and web services, I
naturally used my development machine. I referenced the web services using
localhost since my development machine has both IIS and SQL2K. All fine
and dandy, now my questions, which are probably easy, but this is a new
arena for me (web servies, not VB).

1. When I look at the web references for the app, the reference is
localhost (referring to my development machine). The web services will
ultimately be deployed to the production server which is not localhost.
How will the Windows Forms Client cope with it? The code references
localhost. Will I have to rebuild the client AFTER I have deployed to the
production server? What if, during the life of the app, I need to move the
web services to a different server? How does the client app cope with
that? I feel dumb asking because this seems like a common scenario that I
already should know, but any help is appreciated.

2. I only want my web serviced to be consumed by my client app. How can I
restrict access to only my application? How can I prevent other
applications from detecting and consuming my web services without
permission?

Thanks again, looking forward to any responses.

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
When compiling the application on your development machine, you should use
localhost as your reference. However, you can also store the Url of the
webservice in the app.config file, and then set this value at run time,
using the Url property.

Eg.

MyWebService proxy = new MyWebService();
proxy.Url =
System.Configuration.ConfigurationSettings.AppSett ings["WebServiceUrl"];

Your app.config file would then contain the WebService Url:

<add key="WebServiceUrl"
value="http://ProductionServer/WebServices/SomeService.asmx" />

If during the life of the application, the Url to the webservice changed,
you would only need to change the app.config on each client machine, rather
than change the webreference, recompile, and re-install on every machine.
When the application is run, it will automatically pull the updated
webservice location from app.config.

To answer your second question, there are various ways of securing
webservices. If the application is only going to be used from within your
network, and you've got a fixed IP range, then you could use IP-based
security on the IIS host. You could also use SOAP headers, passing a
username and password or some kind of authorisation ticket in each request
to the webservice. See this article on MSDN for details:
http://msdn.microsoft.com/library/de...OAPHeaders.asp

Hope this helps,

Mun

--
Munsifali Rashid
http://www.munsplace.com/


"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:14*****************************@40tude.net...
A quick scan of the group did not immediately reveal an answer to my
questions so here goes.

First let me describe my app and then I'll ask the questions.

I am writing a Windows Forms App (not Web Forms) that serves as a thin
client to some web services. In other words, the Windows Forms app will be installed on the client machines and that app will call web services that
are deployed on my server.

In the process of developing the Windows Forms app and web services, I
naturally used my development machine. I referenced the web services using localhost since my development machine has both IIS and SQL2K. All fine
and dandy, now my questions, which are probably easy, but this is a new
arena for me (web servies, not VB).

1. When I look at the web references for the app, the reference is
localhost (referring to my development machine). The web services will
ultimately be deployed to the production server which is not localhost.
How will the Windows Forms Client cope with it? The code references
localhost. Will I have to rebuild the client AFTER I have deployed to the
production server? What if, during the life of the app, I need to move the web services to a different server? How does the client app cope with
that? I feel dumb asking because this seems like a common scenario that I
already should know, but any help is appreciated.

2. I only want my web serviced to be consumed by my client app. How can I restrict access to only my application? How can I prevent other
applications from detecting and consuming my web services without
permission?

Thanks again, looking forward to any responses.

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.

Nov 18 '05 #2

P: n/a
Try looking at the Passing Data to a Custom Action walkthrough at:
http://msdn.microsoft.com/library/de...us/vsintro7/ht
ml/vxwlkwalkthroughpassingdatatocustomaction.asp

It shows how to set the WebService reference URL to Dynamic, and then
modifying the web service URL during install time to a user-specified value.
Another approach would be to use the Configuration Override File property.
http://msdn.microsoft.com/library/de...us/vsintro7/ht
ml/vxurfdeploymentconfigurationpropertiesprojectnamep ropertypagesdialogbox.a
sp

In C# you have to set it in your project file, or you can use a macro to do
it. In VB, it is exposed in the Project Properties dialog under the
Deployment tab.

In short, it allows you to have multiple Web.Config files in your project
(with different file names). Use the web.config file for your development
machine, and have a Release.Config file (or named something like that).
When you select the "Release" configuration, the Release.Config file will
be passed to the setup project, but with a Web.Config file name. Put the
full URL into that .config file.
---
David Guyer - VBQA Deployment Testing
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: Chris Dunaway <dunawayc@_lunchmeat_sbcglobal.net>
Subject: Deploying a Windows Forms App that uses Web Services.
User-Agent: 40tude_Dialog/2.0.10.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Date: Thu, 8 Jan 2004 12:09:14 -0600
Message-ID: <14*****************************@40tude.net>
Newsgroups: microsoft.public.dotnet.framework.aspnet,microsoft .public.dotnet.generalNNTP-Posting-Host: 216.143.212.98
Lines: 1
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!cpmsftng xa09.phx.gbl!TK2MSFTNGP08.
phx.gbl!TK2MSFTNGP10.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:120397 microsoft.public.dotnet.framework.aspnet:200671X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

A quick scan of the group did not immediately reveal an answer to my
questions so here goes.

First let me describe my app and then I'll ask the questions.

I am writing a Windows Forms App (not Web Forms) that serves as a thin
client to some web services. In other words, the Windows Forms app will be
installed on the client machines and that app will call web services that
are deployed on my server.

In the process of developing the Windows Forms app and web services, I
naturally used my development machine. I referenced the web services using
localhost since my development machine has both IIS and SQL2K. All fine
and dandy, now my questions, which are probably easy, but this is a new
arena for me (web servies, not VB).

1. When I look at the web references for the app, the reference is
localhost (referring to my development machine). The web services will
ultimately be deployed to the production server which is not localhost.
How will the Windows Forms Client cope with it? The code references
localhost. Will I have to rebuild the client AFTER I have deployed to the
production server? What if, during the life of the app, I need to move the
web services to a different server? How does the client app cope with
that? I feel dumb asking because this seems like a common scenario that I
already should know, but any help is appreciated.

2. I only want my web serviced to be consumed by my client app. How can I
restrict access to only my application? How can I prevent other
applications from detecting and consuming my web services without
permission?

Thanks again, looking forward to any responses.

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.


Nov 18 '05 #3

P: n/a

Thanks to both of you for the helpful info!
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.