Since the number of people who now use WinForm is getting less, May sometimes do a little thing to have to use ASP.net to complete (like a friend of the console please do not thimble), if so, tragedy happens: a gadget (or a small demo project), sent to a friend to use, not to let people also install IIS or vs20xx it? Without these two things, this gadget is really inconvenient to run. What to do? As anyone who has done ASP.net development knows: Web sites usually have to be posted to IIS to run directly, and of course do not exclude you from using VS to open the project and use the VS WebDev.WebServer.exe to start the program. This way inevitably has inconvenient time.
I usually like to write small tools, fortunately, I will WinForm, so this problem is OK to solve. But sometimes I have to put some small site works for others to use, also encounter this problem. Finally I made a very convenient gadget, thoroughly solved the ASP.net web site can not run like WinForm problem. Today, I'm going to show you this gadget (it's very small, less than 300K) and I'm sure you'll like it.
Remember, the name of my tool is:fishaspnetloader
Mode of operation
The tool is not easy to use, the ease of use of the operation is critical, to see how my tools to start a Web site.
In Windows Explorer, locate the directory where you want to start the Web site, right-click the mouse, and click the following image:
Just click "Load this directory as a Web site with Fishaspnetloader".
Yes, I am not wrong, so that can be, any directory can, and do not need you to copy what files to where, " as long as the right mouse click, click the menu on the line ."
The results of the Web site are as follows:
Do you say now is not a WinForm program running?
What do you say, no dialog box? Then you look at it again:
Now it's like a WinForm program.
Supported ASP.net program categories
As mentioned earlier, this gadget is designed to address the limitations of ASP.net program operation. This tool can support WebForm, mvc two kinds of asp.net frameworks. Including my web framework is also supported by OH.
So, theoretically, as long as it is a asp.net program, should be able to run, the program will automatically recognize, and do not need to do any settings. Or that sentence: "Just right click the mouse, click the menu on the line."
Also, the ASP.net version is not a problem, supported from. NET 2.0 to. NET 4.0.
It's also an HTTP server.
Just now I said that my tool can support right click on any folder and load as a Web site. Yes, I'm not talking nonsense. Even if that directory is not a asp.net program directory, is a common file directory, or a static Web page directory, are OK, and the behavior of IIS, if the request is static page, show static page, when the directory, on the list of directories. And at this point the speed will be faster than the ASP.net program Oh. The reason is simple: the asp.net runtime environment is not loaded at this time.
To chart the effect of a table of contents:
Another thing to add: Unlike WebDev.WebServer.exe, my tools are supported by the file name or directory name that Windows can support, exactly the same as the behavior of IIS.
Unfortunately, I haven't done that kind of static web site for a long time, no screenshots are shown. I think you know that.
Support for remote machine access
See the last screenshot, do you have an idea: later if someone asked me to file, I let them go to download ah, this is more secure than the shared directory.
Haha, if you have this idea, then I would like to congratulate you, your safety awareness is not bad. Yes, my tool supports this feature: it allows remote machines to browse the "load directory as a Web site" (not any directory).
For security purposes, the program does not allow remote machines to connect by default, and requires you to manually open them. The operation is also simple, the following figure:
Use the text description is: Right click on the system tray icon, click the "Set Security Parameters" menu. The following dialog box appears:
This dialog box is very simple, I think you understand, here skip 78 words ...
Not limited by Windows Firewall
Just now that we can get remote machine access, here is the problem: from Windows XP, the operating system has integrated the function of the firewall, but also to open the function of a lot of machines. If this is the case, the previous function will encounter problems: may be blocked by the firewall! Oh, this tool is too imperfect, what other people what tools how not to be stopped by the firewall? Fortunately, my tool is not bothered by this problem, it can automatically add it to the Windows Firewall exception list, completely without disturbing your operation.
Windows 7 Firewall can also support OH:
Respect everyone's operating habits
I am more focused on the operation experience, my tools for this concept also has a good support, from the start of the site from the moment began.
When you load a directory as a Web site, the following dialog box appears, asking what browsers you want to select to browse the site:
Note that there is also a small Gogo, sometimes very convenient oh.
Even if you chose a browser at the time, it is easy to change the browser later. Look at the picture below:
The text description is: Right click on the system tray icon, click the "Select Browser" menu. The following dialog box appears:
Still allows you to choose a different browser. I installed 5 kinds of browsers, you installed several?
Built-in multi-label browser support
My gadget, which has a multiple-tagged browser (ie kernel), can still enjoy multiple tabs even if you have only IE6 installed on your machine. And there are two ways to switch OH:
Note: Clicking the Close button in the upper-right corner of the window does not completely exit the program. to exit the program, right-click the drag tray icon and click the Exit menu.
Also, when working in a built-in browser, you can right-click the taskbar and exit the program directly. The following figure (seems not to support Win7):
Startup parameters and configuration files
My gadget, in order to provide some human support, you can set up some startup parameters at startup. you need to start it from the Windows Start menu at this point, and the startup interface is as follows:
Note: When you set up the relevant startup parameters, you can save it, the dialog box has a "Save as" button, the program will save these parameters as a SiteConfig file.
A SiteConfig file can save the configuration parameters that a Web site needs to Fishaspnetloader at startup.
For ease of operation, you can save the configuration parameters of a frequently browsed Web site or directory to a siteconfig file.
When you right-click a menu or pass a directory from the command line on a folder on a resource manager,
Fishaspnetloader will find out if there is a configuration for this directory in the installation directory.
If not, continue to find that there are no related profiles under the target directory.
If not, the My Documents directory also finds that there are no related profiles.
If an associated profile is found, the profile is read.
When you start Fishaspnetloader from the Start menu, the program displays the Set Startup Parameters dialog box.
If you are simply browsing a directory or a native Web site, you can save the current setting as a file named: Default.siteconfig.
Alternatively, if you publish the site "as a tool," You can also prepare the file in advance. This dialog box will not appear later.
When you pass a directory path from the right-click menu or command line in Explorer, and when you do not find a configuration for this directory,
Fishaspnetloader will see if there is a Web.config in that directory, and if this file is present, load the asp.net Runtime, otherwise it won't load to speed up the startup.
If this judgment does not apply to a directory, start Fishaspnetloader from the Start menu and create a SiteConfig file for this directory to specify the appropriate parameters.
The startup profile is designed to allow you to better customize the behavior of your program, and I specifically provide some parameters that allow a Web site to be better disguised as a normal desktop program in a built-in browser.
Not only that, the tool also supports the way the command line is started, you can receive a SiteConfig file, just write a batch and run the batch when you do the installation package.
or refer to the shortcut approach to the installation package of my other tool. The startup command line for that tool is simpler.
You can also refer to the configuration file for this demo program.
In short: or to make it easy for you to use this tool.
Support. NET 4.0
Note: only. NET Frarmework 2.0 is required to run this program
However, if you are running a site that is based on ASP.net 3.5, you will need to install. NET 3.5 to run the. NET 4.0 Web site to install. NET 4.0
If the. NET Framework 4.0 is already installed on your machine, and you want to enable. NET 4 support.
Only the files under the installation directory "FishAspnetLoader.exe.config.bak" can be renamed "FishAspnetLoader.exe.config".
Deployment issues
At the end of this article, I provide the installation package for this tool, and some other files are included in the installation package. The installation package is provided only to make it easier for you to use my tools.
If you have a Web site that you want to start with my tools and run it as a desktop program, you only need to install the Just take the FishAspnetLoader.exe program, you can put the FishAspnetLoader.exe in your installation package, provide a SiteConfig file, and then start my tool on the command line. Please refer to my blog for specific practices:
A comprehensive sample of the common data access layer and AJAX server framework, showing and downloading
Auxiliary tools for sending a database: My-sqlviewer
The above software is packaged and downloaded
Original: Cnblogs.com Fish-li