0
我創建了WCF服務項目。 它在SVC文件中有以下內容。作爲Windows服務託管WCF服務
<%@ ServiceHost Service="Deepak.BusinessServices.Implementation.ApiImplementation"
Factory="Deepak.BusinessServices.Implementation.CustomServiceHostFactory"%>
SVC參考
http://localhost/DeepakGateway/Service.svc
服務是UP和產生WSDL。現在我想將此服務作爲Windows服務託管。 我該怎麼辦?
我已經創建了「Windows服務」項目並有以下代碼。
protected override void OnStart(string[] args)
{
if (m_Host != null)
{
m_Host.Close();
}
Uri httpUrl = new Uri("http://localhost/DeepakGateway/Service.svc");
m_Host = new ServiceHost
(typeof(?????? WHAT TO FILL HERE?), httpUrl);
//Add a service endpoint
m_Host.AddServiceEndpoint
(typeof(?????? WHAT TO FILL HERE?),), new WSHttpBinding(), "");
//Enable metadata exchange
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
m_Host.Description.Behaviors.Add(smb);
//Start the Service
m_Host.Open();
}
有很多服務合同,我需要選擇哪一個! –
@IsharehappyK:你想在這個端點上公開的那個.... –