How to run web programs and Web Services in environments without IIS [original]

Source: Internet
Author: User
Tags webhost

Author: lhxhappy
Link: http://www.cnblogs.com/lhxhappy/archive/2008/08/04/1259503.html

Indicate the source for reprinting.

Recently, a program of online version was developed. The program UI is winform, and data interaction is all embedded into winform using Web Service reports and web forms,

The program of this architecture must be supported by the IIS server; otherwise, the whole program cannot run. Recently, the boss suddenly came up with a whimsy, saying that we want to encapsulate a standalone version of the program for promotion.

Encapsulation is simple, but most single-host customers do not install IIS. Even if IIS is installed, it is basically not configured ~! The program cannot run after it leaves IIS. How can this problem be solved ??

Today, I was suddenly inspired to compile web programs. When compiling web programs in Versions later than vs2005, I can compile and debug them in environments without IIS.

Will run an Asp.net Development Server service. This service is similar to that of IIS. It can be said that it is a simplified version of IIS, although not as complete and mature as IIS

It is sufficient to provide general IIS services. However, you must follow the vs2005 or vs2008 computer to use Asp.net development server to provide IIS server.

But don't worry. Just copy a few key files and run Asp.net development server on a computer without a development environment.

 

Let's take a look at how to start the service of Asp.net development server.

Method 1

Use the command prompt line:

1. Start -- run -- Enter cmd and press Enter.

2. Enter C:/Windows/Microsoft. net/framework/v2.0.50727/webdev. webserver/port: 38438/path: "F:/work/inetpub/wwwroot/lhx"/vpath: "/lhx"

Parameter description:/port: Specifies the port number of the service provided by the Asp.net development server. The value 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/lhx ~! (How is it convenient ?)

 

Method 2:

Start this service through winform (C #)

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:/"F: // work // inetpub // wwwroot // lhx/"/vpath:/"/lhx /""; // 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; // you can specify not to display a window.

P. Start ();

}

 

How can I use Asp.net development server on a computer without vs2005 or vs2008 installed?

1. Copy the webdev. webserver. EXE file from a computer with vs2005 or vs2008 development environment 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. The webdev. webserver. EXE file cannot run Asp.net development server successfully on a computer without a development environment. It is also called webdev. webhost. dll.

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 stored 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.

The above method is enabled normally.

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 execute the doscommand copy C:/Windows/ASSEMBLY/gac_32/webdev. webhost/8.0.0.0 _ b03f5f7f11d50a3a/webdev. webhost. dll C :/

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 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 webdev. webserver. EXE is allowed to discover that the service can be started normally ~!

 

Simple ?? As a lightweight IIS Asp.net development server, it is very good ~!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.