我有一个Windows Service,我需要安装在机器上,运行时间太长,可以发送电子邮件,然后睡觉24小时。 如果我把服务方法从一个网络客户中说出来,则会进行罚款,但当我从窗户服务中叫它时,它每次都失败,错误信息没有给我具体调查:
来文对象,系统。 Service Model。 渠道。 服务 频道不能用于通信,因为它处于无政府状态。
public partial class EDBDailyLogMailer : ServiceBase
{
Thread thread;
public EDBDailyLogMailer()
{
InitializeComponent();
this.ServiceName = "EDB Daily Log Mailer";
}
protected override void OnStart(string[] args)
{
try
{
thread = new Thread(MailLogDaily);
thread.Start();
}
catch (Exception ex)
{
throw ex;
}
}
static void MailLogDaily()
{
while (true)
{
try
{
using (ApprovableFieldClient client = new ApprovableFieldClient())
client.EmailEventLog();
Thread.Sleep(86400000);
}
catch (Exception ex)
{
throw ex;
}
}
}
}
电子邮件地址记录仪的编码在从其他地方叫来时进行罚款,因此,我赢得了该密码。 我在上诉书中最后指出:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="ExperienceServiceBinding" maxReceivedMessageSize="1048576" maxBufferSize="1048576"/>
</netTcpBinding>
</bindings>
<client>
<endpoint bindingConfiguration="ExperienceServiceBinding" address="net.tcp://bosvc01:1125/ApprovableFieldService" binding="netTcpBinding" contract="Ropes.Experience.Administration.Contracts.Services.IApprovableFieldService">
<identity>
<servicePrincipalName value="firstname.lastname@somecompany.com"/>
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="Ropes.Experience.Administration.Managers.ApprovableFieldManagerBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
适用外勤人事科的办公地点设在布沃茨01:1125
任何建议都将受到高度赞赏。 谢谢。