English 中文(简体)
校正作为世界文化基金会服务
原标题:Threading as a WCF Service

我有一个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

任何建议都将受到高度赞赏。 谢谢。

问题回答

溶解。 我删除了我的所有尝试/渔获物,并在错误信息中作了更多的描述。

由于在客户代理对象周围使用 block块,你可能会遇到问题。 本条:http://msdn.microsoft.com/en-us/library/a355056.aspx

要求处置你的客户代理人可能会掩盖根本的例外。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签