【发布时间】:2013-06-15 18:17:59
【问题描述】:
我已经设置了一个 node.js 应用程序以在 Azure 云服务上的辅助角色(而不是 Web 角色)上运行。在 HTTP 上运行的标准应用程序一切正常。
现在我正在尝试让它在 HTTPS 上通过 SSL 运行,并已成功按照http://www.windowsazure.com/en-us/develop/nodejs/common-tasks/enable-ssl-worker-role/ 的说明进行操作,但它没有产生正确的结果!
现在,当通过 HTTP 或 HTTPS 访问 url 时,连接超时并且没有返回任何内容。
是否有任何我可能遗漏的内容或上面链接的指南中未包含的任何步骤?
我在指南中注意到的一件事是这条线是否......
<InputEndpoint name="HttpIn" protocol="tcp" port="443" />
...实际上应该是 HttpsIn 吗?虽然改变这一点似乎并没有太大的不同。
更新:这是我的一些配置文件
ServiceConfiguration.cloud.cscfg
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="*removed*" osFamily="2" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="WorkerRole1">
<ConfigurationSettings />
<Instances count="1" />
<Certificates>
<Certificate name="certificateName" thumbprint="*removed*" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="*removed*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WorkerRole name="WorkerRole1" vmsize="ExtraSmall">
<Startup>
<Task commandLine="setup_worker.cmd > log.txt" executionContext="elevated">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
</Variable>
<Variable name="RUNTIMEID" value="node" />
<Variable name="RUNTIMEURL" value="http://az413943.vo.msecnd.net/node/0.8.4.exe" />
</Environment>
</Task>
<Task commandLine="node.cmd .\startup.js" executionContext="elevated" />
</Startup>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="80" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="certificateName" />
</Endpoints>
<Certificates>
<Certificate name="certificateName" storeLocation="LocalMachine" storeName="My" />
</Certificates>
<Runtime>
<Environment>
<Variable name="PORT">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='HttpIn']/@port" />
</Variable>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
</Variable>
</Environment>
<EntryPoint>
<ProgramEntryPoint commandLine="node.cmd .\server.js" setReadyOnProcessStart="true" />
</EntryPoint>
</Runtime>
</WorkerRole>
</ServiceDefinition>
我还尝试了这些的各种变体(使用更少的额外标签和属性),但似乎没有任何效果。
【问题讨论】:
-
name属性只是一个名称。protocol和port属性是重要的属性,它们根据您引用的配置和文档正确设置。为了帮助您,您需要在您的问题中粘贴您的节点云服务的.csdef和.cscfg文件。您可能更改了其他内容。您引用的说明是正确和准确的。 -
感谢您对名称的澄清。我已经用一些配置文件更新了我的帖子。最初我没有更改任何其他内容,但由于它不起作用,我尝试添加一些额外的位(似乎没有任何帮助),直到您在上面看到粘贴的内容。
标签: node.js azure https azure-worker-roles