2012-03-13 73 views
0

我已经创建了一个简单的web服务。 然后我创建了一个控制台主机必须通过HTTPS URL托管服务..wcf为什么我看不到我的https网站

这是我的配置:

 <?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <services> 
      <service behaviorConfiguration="mexBehaviour" name="NuriServiceLibrary.NuriService"> 
       <clear /> 
       <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfig" 
        contract="NuriServiceLibrary.iNuriService" listenUriMode="Explicit" /> 
       <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
       <host> 
        <baseAddresses> 
         <add baseAddress="https://192.168.....:8001/SecureConsole" /> 
        </baseAddresses> 
       </host> 
      </service> 
     </services> 
     <behaviors> 
     <serviceBehaviors> 
      <behavior name="mexBehaviour"> 
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 

     <bindings> 
     <basicHttpBinding> 
      <binding name="basicHttpBindingConfig"> 
      <security mode="Transport"> 
       <transport clientCredentialType="None" /> 
      </security> 
      </binding> 
     </basicHttpBinding> 
     </bindings> 
    </system.serviceModel> 
</configuration> 

,这是我的Program.cs:

static void Main(string[] args) 
     { 
      ServiceHost host = new ServiceHost(typeof(NuriService)); 
      host.Open(); 
      foreach (Uri address in host.BaseAddresses) 
      { 
       Console.WriteLine("Listening on " + address); 
      } 
      Console.WriteLine("Press <Enter> to terminate Host.\n\n"); 
      Console.ReadLine(); 

      host.Close(); 
     } 

我通过以下方式创建了证书: 1. makecert.exe -sr LocalMachine -ss My -n CN = 192.168 ..... -sky exchange -sk -pe 2. netsh http add sslcert ipport = 192.168 ....: 8001 certhash =(故意离开)appid = {(故意离开)}

但问题是,我看不到我的https网页...我看到这个网站不可用.. 任何人有想法?

+0

? – 2012-03-13 12:49:48

+0

没有,我添加了端口:9000的IP,但后来网站wouldnt也显示.. – skyyyy 2012-03-13 12:53:04

+0

你在哪里“*添加*”与端口9000的IP地址?另外,当你说“*网站*”时,你的意思是WCF帮助页面? – 2012-03-13 12:57:40

回答

1

尝试添加HttpsGetUrl属性的<serviceMetadata>并指定空字符串

<serviceBehaviors> 
    <behavior name="mexBehaviour"> 
     <serviceMetadata httpGetEnabled="false" 
          httpsGetEnabled="true" 
          httpsGetUrl="" /> 
    </behavior> 
</serviceBehaviors> 

这将使服务元数据可通过该服务的base address

https://localhost:8001/SecureConsole?wsdl 
+0

不工作的网页仍然不显示:( – skyyyy 2012-03-13 13:17:31

+0

什么HTTP错误你会得到?404?500? – 2012-03-13 13:20:02

+0

111(网:: ERR_TUNNEL_CONNECTION_FAILED):未知错误 – skyyyy 2012-03-13 13:20:30

0

通过你实现你只能期望通过在Web浏览器中寻址您的基地址来查看由您的服务发布的元数据。在你尝试做这件事情之前,值得在视觉工作室的debugegr中运行你的服务(不要运行主机,只需运行service/lib)。如果这样运行没有错误,那么尝试并在浏览器中解决该服务。

如果你真正想要的是托管服务,并和使用Web浏览器作为客户端,那么你需要考虑什么是您使用的URL来访问服务元数据ASP.net

相关问题