Я пытаюсь запустить службу WCF в приложении Windows Forms.Я скопировал и изменил код, найденный в примерах WCF от Microsoft.При запуске образца WCF служба отображается в мониторе портов (CurrPorts), который я использую.Когда я запускаю свой код, я не вижу свой сервис ...
Это мой код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace NoName.Server
{
[ServiceContract(Namespace="http://NoName")]
public interface IApplicationService
{
[OperationContract()]
NoName.Entities.MediaParameter[] GetParametersForMediaObject(string mediaObjectId);
[OperationContract()]
NoName.Entities.MediaParameter GetMediaParameter(string parameterId);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NoName.Server
{
public class ApplicationService : IApplicationService
{
public Entities.MediaParameter[] GetParametersForMediaObject(string mediaObjectId)
{
throw new NotImplementedException();
}
public Entities.MediaParameter GetMediaParameter(string parameterId)
{
throw new NotImplementedException();
}
}
}
Я запускаю его из формы как
private void toolStripButton1_Click(object sender, EventArgs e)
{
using (ServiceHost host = new ServiceHost(typeof(ApplicationService)))
{
host.Open();
}
}
И конфигурация в app.config:
<system.serviceModel>
<services>
<service name="NoName.Server.ApplicationService" behaviorConfiguration="ApplicationServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/NoName/ApplicationService"/>
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: http://localhost:8000/NoName/ApplicationService -->
<endpoint address="" binding="wsHttpBinding" contract="NoName.Server.IApplicationService"/>
<!-- the mex endpoint is exposed at soap.tcp://localhost:8000/NoName/ApplicationService/mex -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior name="ApplicationServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Он компилируется без ошибок, без исключений, когда я его запускаю.Это просто не будет существовать.Идеи?