RE: How to create a local server (i.e., localhost)



Hi Lance,

Thanks for your reply.

As I mentioned in the last reply, the WebDev.TestServer is designed as a
GUI/winform application which is recommended to host in an interactive
logon user session and hard to automate in a non-interactive service
session. For the new questions you mentioned, here are some of my
understanding and suggestions:

1. Is there any way to hide the icon that appears in the notification area
of the task bar?
=======================
I'm afraid this is limited by the webserver.exe since by default the
windows is not displayed and it is only the icon on taskbar that let the
user to interactive with the Webserver program. And I've lookup the
disassembly code of the webserver.exe, the icon is forced to display and
there is no configuration options.


2. Is there any way to programically stop the ASP.NET Development Server on
a given port (e.g., 8888)?
======================
Since the webserver.exe is a winform application which has a main window,
when we manage it interactively, we could stop it by clicking the "Stop"
button on the winform. If you want to programmatically stop it, so far what
I've got is using WIN32 API to programmatically find the webserver.exe
application's main window and send some messages to the "Stop" button to
end it. This also require we're doing this in an interactive environment
(in a console or winform application that running under interactive logon
session).


3. Is there any way to determine whether the ASP.NET Development Server is
already running on a given port?
========================
I think this is possible, since the port number is always append in the
webserver.exe applicaion main windows's Caption, we can capture the
caption of the window and pick the port number from the caption string. Of
course, we need to programmatically find all the existing webserver
application windows first.

For your convenience, I've created a complete demo project which contains
the necessary code to do the work for #2 and #3 above. Most of them require
calling win32 API through PINVOKE. I've attached this project in this
thread, you can get it if you're using Outlook Express to visit the NNTP
newsgroup. If you have problems accessing it, please feel free to let me
know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.


Attachment: ProcessConsole.zip
Description: Binary data


Loading