[英]wcf why can't I see my https site
我创建了一个简单的Web服务。 然后,我创建了一个控制台主机,该主机必须通过https URL托管服务。
这是我的配置:
<?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我的-n CN = 192.168 ..... -sky exchange -sk -pe 2. netsh http add sslcert ipport = 192.168 ....:8001 certhash =(故意离开)appid = {(故意离开)}
但是问题是,我看不到我的https网页...我看到此网站不可用。有人知道吗?
尝试将HttpsGetUrl属性添加到<serviceMetadata>
serviceMetadata <serviceMetadata>
并指定一个空字符串 :
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="false"
httpsGetEnabled="true"
httpsGetUrl="" />
</behavior>
</serviceBehaviors>
这将通过服务的基本地址使服务元数据可用:
https://localhost:8001/SecureConsole?wsdl
通过实现,您只能期望通过在Web浏览器中寻址基址来查看服务发布的元数据。 在尝试执行此操作之前,值得在Visual Studio中的debugegr中运行服务(不运行主机,仅运行service / lib)。 如果运行没有错误,则尝试在浏览器中找到服务地址。
如果您真正想要的是托管服务并使用Web浏览器作为客户端,那么您需要研究ASP.net
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.