Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

Windows Server Hosting - ASPHostPortal :: How to Host Node.js on Windows with IIS as Reverse Proxy

clock July 3, 2019 09:30 by author Jervis

Unfortunately a lot of companies are still stuck with Windows servers. Nobody ever got fired for choosing Microsoft, right. As a developer this can be frustrating because choosing a server technology is usually limited to ASP.Net. I have experimented with hosting Node.js applications on a Windows server by using iisnode. But it is a pain to get up and running, setting the correct permissions is a time consuming chore. Microsoft has taken control of the development of the project but I get the feeling it's not very active any more. There are several Stackoverflow questions where people just give up configuring it.

So I wanted to go another route. What if we could use the Node.js web server and use IIS as a reverse proxy to route traffic to the Node.js web server? We could ditch iisnode and hopefully have a more reliable solution for hosting Node.js web applications.

First we need a small test project, this hello world Node.js Express application will do:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

To be able to run this, you need to install Node.js on your server. Once it's installed, you can run the test application by opening a command prompt and typing node app.js. If everything goes well you should now be able to access the test application via http://localhost:3000 on your local server.

To configure IIS as reverse proxy you need to install the URL Rewrite extension and the Application Request Routing extension. The URL Rewrite extension allows you to define rules to enable URLs that are easier for users to remember and for search engines to find. The Application Request Routing extension enables scalibility features: load balancing, rule-based routing and more.

Once these extensions are installed, you can begin configuring IIS. Open the Internet Information Services (IIS) Manager by opening the run window and typing the inetmgr command. Select the site for which you want to set up the reverse proxy and open the URL Rewrite extension.

 Add a new rule and select the Reverse Proxy template.

Enable proxy functionality when you are prompted for it.

Add the address of your node.js website, don't forget to include the port, to the reverse proxy rules.

Once the rule has been added, the reverse proxy configuration works.

The last piece that's needed is a reliable way of running the Node.js application. Starting it via the command prompt and keeping the window open is not a durable solution. If someone logs on to the server and closes the window, the website goes down. pm2 is a Node.js process manager, it can be used to keep applications running. Installing pm2 is easy with npm:

npm install -g pm2

Once installed, we can use these commands to manage our processes:

  • pm2 start app.js: start our Node.js application
  • pm2 stop: stop a running process
  • pm2 restart: restart a running process
  • pm2 list: list all running processes

pm2 can do so much more, check out their website for more info. 

 



Free Windows Server 2012 Hosting - ASPHostPortal.com :: New Powershell v3 with Windows Server 2012

clock December 7, 2013 06:25 by author Ben

PowerShell v3.0 is the version included with Server 2012. A great place for PowerShell newbies to get started is with PowerShell's IntelliSense. This feature will help you learn and create the proper PowerShell. As you type in a PowerShell command, you'll see a list of possible syntaxes to go with the command.

 


For example, you may want to install a feature through PowerShell, but are unsure of the proper syntax or exact feature name. Features can be installed through PowerShell with the command instaW-windowsfeature-name. If you go into the Windows PowВ­erShell ISE (integrated scripting engine) and start typing Install . You'll see a dropВ­down menu of all the possible commands that can be used with Install (image 1).

Image 1 - PowerShell IIntelliSense

Image 1 - that you also have a list of modules to scroll through to find the available cmdlets in PowerShell. PowerShell in Server 2012 provides command-line management , and with IntelliSense, also teaches you how to use correct PowerShell syntax at the same time.

WHile there are numerous new capabilities in PowerShell, another significant new feaВ­ture that many of you will want to get acquainted with is Windows PowerShell  Web Access. This feature allows you to manage remote machines using PowerShell through a web browser.


To set up this feature, follow these steps:

1. From Server Manager 's dashboard, click "Add roles and features." Click Next and select "Role-based or feature-based installation." Click Next. Select the server for installation. Click Next again. In the "Select server roles" window, click Features from the left-side menu. Scroll through the features until you see "Windows PowВ­erShell (Installed)." Expand this feature, and Windows PowerShell Web Access  is listed.



2. Select Windows PowerShell Web Access and click Add Features. Click Next three times and then click Install.

3. To automatically configure Windows PowerShell Web Access to use default settings, run Install-PswaWebApplication as an administrator in PowerShell.
After installation, you will see IIS listed in the Server Manager dashboard. The next step in setting up PowerShell Web Access is to configure IIS. In this example, you'll set up PowerShell Web Access in an IIS subfolder:


a. From Server Manager, click Tools and then IIS Manager. Now you need to create an application pool, which is done by expanding the IIS server name, right-clicking on Application Pools, and then selecting Add Application Pools.

b. Name the PowerShell Web Access application pool and click OK.

 

 



c. Right-click the Sites Folder under Default Web Site in the left hand IIS Manager pane. Select Add Application.

d. Enter an alias for the application and browse to select the application pool created in PowerShell Web Access. Also enter the physical path to PowerShell Web Access, which is file:///c:windowswebpowershellwebaccesswwwroot"C:WindowsWebPowerShellWebAccesswwwroot Configure and check authentication by using the "Connect as" and "Test settings" buttons. Click OK.

You can remotely use PowerShell Web Access through a browser by entering the name of the computer PowerShell Web Access is installed on and the name of the PowerShell Web Access Application as a URL in a browser.

SO, for this example, the machine name is DC1 and the PowerShell Web Access Application name is PSWA. After entering the URL http://dc1/pswa > Http://DC1/PSWA , We get the logon screen shown.



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

 photo ahp banner aspnet-01_zps87l92lcl.png

Author Link

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in