Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使SSL在Azure实例上工作_Ssl_Azure_Ssl Certificate - Fatal编程技术网

无法使SSL在Azure实例上工作

无法使SSL在Azure实例上工作,ssl,azure,ssl-certificate,Ssl,Azure,Ssl Certificate,我一直在绞尽脑汁试图弄明白为什么SSL在我的一个Azure项目中有效,但在另一个项目中无效 当我导航到我的站点时,说https://foo.com,我甚至无法连接到该站点。浏览器根本无法连接,curl说“无法连接到主机”。但是,如果我转到我的cloudapp.net URL(例如https://foo.cloudapp.net),它可以连接,但浏览器会抱怨说我的证书是为*.foo.com。注意:我可以连接到http://foo.com没有任何问题 下面是我的代码,其中某些值被混淆了 Servic

我一直在绞尽脑汁试图弄明白为什么SSL在我的一个Azure项目中有效,但在另一个项目中无效

当我导航到我的站点时,说
https://foo.com
,我甚至无法连接到该站点。浏览器根本无法连接,curl说
“无法连接到主机”
。但是,如果我转到我的cloudapp.net URL(例如
https://foo.cloudapp.net
),它可以连接,但浏览器会抱怨说我的证书是为
*.foo.com
。注意:我可以连接到
http://foo.com
没有任何问题

下面是我的代码,其中某些值被混淆了

ServiceDefinition.csdef:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="www" vmsize="Small">
<Sites>
  <Site name="Web">
    <VirtualApplication name="r" physicalDirectory="../Foo/Bar" />
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" />
      <Binding name="Endpoint2" endpointName="Endpoint2" />
    </Bindings>
  </Site>
</Sites>
<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="80" />
  <InputEndpoint name="Endpoint2" protocol="https" port="443" certificate="STAR.foo.com" />
</Endpoints>
<Imports>
  <Import moduleName="Diagnostics" />
</Imports>
    <Certificates>
      <Certificate name="STAR.foo.com" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
</WebRole>
</ServiceDefinition>
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="myApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="www">
<Instances count="2" />
<ConfigurationSettings>
  <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
<Certificates>
  <Certificate name="STAR.foo.com" thumbprint="1234567890" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>

我的证书已上载,指纹匹配(在本例中也是“1234567890”)

ServiceConfiguration.csfg:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="www" vmsize="Small">
<Sites>
  <Site name="Web">
    <VirtualApplication name="r" physicalDirectory="../Foo/Bar" />
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" />
      <Binding name="Endpoint2" endpointName="Endpoint2" />
    </Bindings>
  </Site>
</Sites>
<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="80" />
  <InputEndpoint name="Endpoint2" protocol="https" port="443" certificate="STAR.foo.com" />
</Endpoints>
<Imports>
  <Import moduleName="Diagnostics" />
</Imports>
    <Certificates>
      <Certificate name="STAR.foo.com" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
</WebRole>
</ServiceDefinition>
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="myApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="www">
<Instances count="2" />
<ConfigurationSettings>
  <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
<Certificates>
  <Certificate name="STAR.foo.com" thumbprint="1234567890" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>

Azure控制台:

我已核实:

我的证书已上载

  • 我是SHA1
  • 它的指纹与我在ServiceConfiguration.cscfg中指定的匹配(在本例中为“1234567890”)
  • 证书颁发机构的证书也存在(对我来说是“PositiveSSL CA”和“AddTrust外部CA根”)
  • 对于Azure实例,它确认有2个端点(端口80和端口443)

为什么我根本无法通过
https://foo.com
,但我的
https://foo.cloudapp.net
将加载(尽管触发浏览器警告)?这似乎表明我的配置是正确的,但其他东西是关闭的。。。想法?

我想你可能找错了你的问题所在

您如何将foo.com映射到您的站点地址

请注意,Azure实例提供了动态IP地址-您的站点现在所在的地址可能不是明天所在的地址。Azure的建议是在您的域记录中添加一个指向“foo.cloudapp.net”的“www”CNAME DNS条目

这样,当有人浏览www.foo.com时,DNS服务器会(不可见地)说“嘿,实际上,该站点是foo.cloudapp.net。然后浏览器会询问foo.cloudapp.net的IP地址。该域由Microsoft管理,Microsoft将返回您站点的当前IP地址

如果您希望foo.com仍能让您访问www.foo.com,您必须设置DNS重定向,以便每当有人在其浏览器中键入foo.com时,他们都会被重定向到www.foo.com。这将使浏览器解析foo.cloudapp.net,然后HTTP请求将发送到您的站点。一些域宿主为此收取费用(通常是象征性的费用),有些人提供免费服务


HTH.

您能在没有SSL的情况下连接到服务器吗?比如?以确保映射正确。如果foo.com不起作用,请尝试www.foo.com是的,我能够正确连接,只是不能通过SSL。我已更新了我的原始帖子以说明这一点。