Developing the node. JS program on Visual Studio (2)--Remote debugging and publishing to Azure

Source: Internet
Author: User
Tags microsoft website

"Off-topic"

Last introduced the plug-in node. js Tools for Visual Studio (Ntvs) that was developed on VS, which provides very convenient development and debugging capabilities, and of course, in many cases due to platform limitations, you need to run programs on other machines that require remote debugging capabilities , but fortunately, the remote debugging provided by Ntvs is also very convenient.

"Series Index"

    1. Developing the node. JS program on Visual Studio--ntvs introduction and use
    2. Developing the node. JS program on Visual Studio (2)--ntvs remote debugging and publishing to Azure

"Article index"

    1. Ntvs Remote Debugging
    2. Ntvs Deploying to Azure

"One, Ntvs remote debugging"

Ntvs provides a remote debugging proxy for remote debugging, in effect, to not allow node. JS to run the program to be debugged directly, but instead to run the remote debugging agent and then the agent to execute the program and communicate with vs.

Get Ntvs provides remote debugging agent can click "Tools", "node. js Tools", "Debugging Proxy", "Open Container Folder" in vs. The remotedebug.js in the folder.

The parameters of the Remotedebug.js are:

Node remotedebug.js [args] <script to debug> [script args]

The remotedebug.js is followed by the parameters of the remote debugging agent, followed by the debug code file, followed by the parameters of the code file to be debugged, where the parameters supported by the remote Debugging agent are:

-localport <port Num>: Port number of native machine (Ntvs machine), default is 5859

-machineport <port num>: port number of the target machine (machine executing the program), default is 5858

-waitforattach: Executes the program when the attachment succeeds, default to execute the program immediately after executing the script on the target machine

-breakatentrypoint: Use the--DEBUG-BRK parameter when executing the code you want to debug from the breakpoint at the first entry code, which defaults to--debug

So if we press the default setting, we just need to copy the remotedebug.js to the target machine along with the code to be executed, then execute the following statement:

Node Remotedebug.js server.js

If correct, something similar will appear:

Then select "Tools", "Attach to Process" in VS, then select "Node remote Debuggin (unsecured)" In the transfer (for example).

Then enter the address and port of the target machine in the limit character and type Enter, the correct words will appear below the target machine (for example), and finally click "Attach".

The next step is as simple as debugging locally.

"Two, Ntvs deployment to Azure"

There are many ways to deploy node. js, such as a Web site that can be deployed on Azure or a cloud service (Web role), and currently Ntvs only supports the former. Because azure Web sites are supported for node. JS through the Iisnode module on IIS, you need to configure Iisnode, which is to configure the Web. config file, in addition to the deployment Program files. In Ntvs, support for the Azure Web site is reflected in its two Azure project templates, in which the configuration file is automatically generated when the project is created using these two project templates for easy deployment. Of course, traditional methods such as uploading files yourself or uploading files through a code base (see related link 3) are deployed to the Azure Web site or deployed to the cloud service via web role (see related link 4) and so on, and there are detailed articles on the Microsoft website.

For azure projects created by Ntvs, the default includes two Web. config files, the Web. config for local testing, and the Web.cloud.config deployed to Azure, which can be modified individually, which, when uploaded, automatically modifies the name " Web. config ".

As with other projects, you can publish your own profile to a specified folder, FTP, and so on. For Windows Azure Projects, you can select the Import button on the profile page of the first step of the Publish dialog box, select Import from Windows Azure Web site, and then click Sign in to enter your own Windows Azure user name and password. Once the login is successful, it will appear as shown, then select the Azure website you want to publish below.

After you determine the VS will automatically download the configuration information for the specified Web site from Windows Azure, then set up the connection information in the second step of the connection, and then you can deploy the project files to the Azure Web site in the next step. In the final step, you can click "Start Preview" to view or select the file to upload, for the azure site, you only need to upload all JS files, The Web. config file and related static files are used, and the bin directory and Package.json and readme.md do not need to be uploaded. Where the configuration file selects only the Web. config file, it automatically uses the Web.cloud.config file when it is published, and if you select the Web.cloud.config file, the file name is "Web.cloud.config" after the upload.

But I don't know why. In my case, a visit to the Azure Web site after a successful release prompts "You don't have a permission to view this directory or page." The Web. config is not configured correctly, so you can only re-upload the Web. config again to resolve it. However, if you do not modify the Web. config file, then publish only JS and other files.

"RELATED LINKS"

    1. Debugging node. JS running on Linux:http://nodejstools.codeplex.com/wikipage?title=nodejsonlinuxonazure
    2. Azure deployment:http://nodejstools.codeplex.com/wikipage?title=azuredeployment
    3. Build a node. JS Web site and deploy to Windows azure:http://www.windowsazure.cn/zh-cn/develop/nodejs/tutorials/create-a-website-(MAC)/
    4. Build a node. JS application and deploy it to Windows Azure cloud services: http://www.windowsazure.cn/zh-cn/develop/nodejs/tutorials/getting-started/

Developing the node. JS program on Visual Studio (2)--Remote debugging and publishing to Azure

Related Article

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.