我已成功创建WCF self-hosted HTTP
Web 服务。我webserviceHost
用来创建这个服务。我没有对web.config
文件进行任何更改。这是我的代码:
实例.cs:
[OperationContract, WebInvoke(Method = "GET", UriTemplate = "/getstatus/", ResponseFormat = WebMessageFormat.Json)]
bool getstatus();
服务.cs:
public bool getstatus()
{
return true;
}
绑定WS.cs
void bindservice()
{
try
{
m_running = true;
// Start the host
m_serviceHost = new WebServiceHost(typeof(Swiper.cs), new Uri(http://localhost:8083"));
ServiceEndpoint ep = m_serviceHost.AddServiceEndpoint(typeof(Instace.cs), new WebHttpBinding(), "");
m_serviceHost.Open();
while (m_running)
{
// Wait until thread is stopped
Thread.Sleep(SleepTime);
}
// Stop the host
m_serviceHost.Close();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
if (m_serviceHost != null)
{
m_serviceHost.Close();
}
}
}
上面的代码可以正常运行WCF
。Htpp
但我如何将其转换为HTTPS
. 我关注了很多博客,但没有得到任何东西。有可能做到吗?