How do I specify node.exe.config for web app hosted on azure?

你。 提交于 2019-12-12 03:24:47

问题


I have a node server deployed to azure and am using Edge.js to make some WCF calls. When I host the server locally, everything works great because I can put the .NET config for the web service calls in node.exe.config located next to my local node.exe as recommended here.

However, this does not seem feasible for a node server hosted on azure. Azure doesn't seem to let user arbitrarily put files on their file systems on whatever machine the user's server happens to be currently running on (which is completely reasonable). Is there a way I can tell edge or node to look for the config in a different location?


回答1:


At first, we should check out whether your WCF calls can be called from public network via the endpoint of the WCF calls.

If we can call the WCF call via the endpoint, we can directly call it in node.js.

Now I have an endpoint of WCF REST service like “http://IP:port/Service.svc/Select?type=-1”, and here is my code snippet about calling this service in node.js:

router.get('/wcfCall', function (req, res, next) {
    var request = require('request');
    var r = request('http://IP:port/Service.svc/Select?type=-1');
    r.on('data', function(data) {
        console.log('decoded chunk: ' + data)
    })
    .on('response', function(response) {
        response.on('data', function(data) {
            console.log('received ' + data.length + ' bytes of compressed data')
        })
    })
})  


来源:https://stackoverflow.com/questions/32891918/how-do-i-specify-node-exe-config-for-web-app-hosted-on-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!