At Microsoft. in the. NET platform, When you compile web programs in Visual Studio 2005 or later versions, you can compile and debug them in environments without IIS, during each debugging, an Asp.net Development Server service is run. This service is similar to that of IIS. It can be said that it is a simplified version of IIS, although not as mature as IIS, it is enough to provide general IIS services. As a standalone service, it is a good choice, this service is installed with webdev in Visual Studio 2005 or Visual Studio 2008 IDE. webserver
. EXE file. This file can be released independently and can be used together with webdev. webhost. DLL to use the Asp.net Development Server service.
The first method is to use the command prompt line:
1. Start -- run -- Enter cmd and press Enter.
2. Enter c: \ windows \ Microsoft in the command prompt line. net \ framework \ v2.0.50727 \ webdev. webserver/port: 38438/path: "C: \ Inetpub \ wwwroot \ myweb"/vpath: "/myweb"
Parameter description:
/Port: Specifies the port number of the Asp.net development server to provide services. The port number ranges from 1.
/Path: physical path for storing web programs.
/Vpath: (optional) the default path is "/".
3. Open IE and access your website through URL: http: // localhost: 38438/myweb ~! (How is it convenient ?)
Second, use winform (C #) to start the service.
The implementation method is as follows:
Private void runserver ()
{
PROCESS p =New process ();
P. startinfo. filename = "cmd.exe "; // Set the program name
P. startinfo. arguments = "/C" + "C :\\ Windows \ Microsoft. net \ framework \ v2.0.50727 \ webdev. webserver/port: 38438/path: \ "C: \ Inetpub \ wwwroot \ myweb \"/vpath: \ "/myweb \""; // Set the program line execution Parameters
P. startinfo. useshellexecute = false; // Close shell usage
P. startinfo. redirectstandardinput = true; // Redirect standard input
P. startinfo. redirectstandardoutput = true;// Redirect standard output
P. startinfo. redirectstandarderror = true; // Redirect error output
P. startinfo. createnowindow = true; // Set not to display the window
P. Start ();
}
How can I use the Asp.net development server on a computer without Visual Studio 2005 or Visual Studio 2008 installed?
1. Copy the webdev. webserver. EXE file from the computer where Visual Studio 2005 or Visual Studio 2008 development environment is installed.
The vs2005 path is c: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ webdev.webserver.exe
The webdev. webserver. EXE file of vs2008 is in c: \ Program Files \ common files \ microsoft shared \ devserver \ 9.0 \ webdev. webserver. exe
2. copy only webdev. webserver. EXE and run Asp.net development server successfully on a computer without a development environment. A file called webdev. webhost. dll is also missing.
In the vs2005 environment, this file is stored in the c: \ windows \ Assembly \ gac_32 \ webdev. webhost \ 8.0.0.0 _ b03f5f7f11d50a3a path.
In the vs2008 environment, this file is saved in the c: \ windows \ Assembly \ gac_32 \ webdev. webhost \ 9.0.0.0 _ b03f5f7f11d50a3a path.
We need to copy the file from a computer with a development environment, and then copy the file to the Asp.net development server in the same path of the computer without the development environment.
To copy webdev. webhost. dll, you must run the doscommand in the command prompt line.
The procedure is as follows:
First: start -- run -- Enter cmd to bring up the command prompt line
Then run the doscommand copy c: \ windows \ Assembly \ gac_32 \ webdev. webhost \ 8.0.0.0 _ b03f5f7f11d50a3a \ webdev. webhost. dll c :\
Alternatively, run the doscommand copy c: \ windows \ Assembly \ gac_32 \ webdev. webhost \ 9.0.0.0 _ b03f5f7f11d50a3a \ webdev. webhost. dll c: \ in the command prompt line :\
In this way, the webdev. webhost. dll file is copied to the C root directory.
Finally, set webdev. webserver. EXE and webdev. webhost. copy the DLL file to a computer without a development environment installed, create a text file, copy the following content to the text file, and save it,
MD % SystemRoot % \ Assembly \ gac_32 \ webdev. webhost \ 8.0.0.0 _ b03f5f7f11d50a3a
Xcopy c: \ webdev. webhost. dll/Y % SystemRoot % \ Assembly \ gac_32 \ webdev. webhost \ 8.0.0.0 _ b03f5f7f11d50a3a
Change the file name of the text file to copy. bat, copy Copy. bat to the folder that saves webdev. webhost. dll, and run copy. bat.
OK. Now running webdev. webserver. EXE finds that the service can be started normally ~!
Simple ?? As a lightweight IIS Asp.net Development ServerBut it's pretty good ~!