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;
}
BindingWS.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
ます。私は非常に多くのブログをフォローしていますが、何も得られませんでした。それは可能ですか?