从windows-service执行的自定义引导程序,找不到端点

时间:2012-12-19 12:53:51

标签: c# wcf windows-services console-application http-proxy

我们有一个由windows-service和一个控制台应用程序组成的解决方案,它作为一个引导程序,为工作项调用WCF服务。

除了在客户环境中运行解决方案时,所有这一切都正常工作,客户环境位于http代理后面的封闭网络中以进行外部访问。一切都按预期工作,直到引导程序调用WCF服务,24s退出后出现以下错误:

System.ServiceModel.EndpointNotFoundException:https://www.MyDomian.com/MyService.svc等没有端点监听...

现在,这是踢球者。如果我手动启动引导程序(双击exe),它会毫无问题地连接到WCF服务。

已知事实

  • 针对端口443的流量打开代理,www.MyDomian.com
  • 我们拥有客户计算机的管理员权限
  • WCF服务托管在Windows Azure
  • 解决方案适用于普通网络!
  • WCF配置为使用https
  • 客户计算机上的IE和Chrome均可访问
  • https://www.MyDomian.com/MyService.svc
  • IE:Internet选项,使用http-proxy配置
  • Bootstrapper使用channelFactory连接到wcf服务

代码windows-service用于启动引导程序:

var p1 = new Process{StartInfo = { UseShellExecute = false, FileName = MyConsoleApplication.exe } };

p1.StartInfo.UseShellExecute = false;
p1.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p1.StartInfo.RedirectStandardInput = true;
p1.StartInfo.RedirectStandardError = true;
p1.StartInfo.RedirectStandardOutput = true;

p1.Start();

主机上的WCF配置:

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="MyBinding"
             maxReceivedMessageSize="500000"
             maxBufferSize="500000"
             maxBufferPoolSize="500000"  
             receiveTimeout="00:02:00" 
             sendTimeout="00:02:00"
             useDefaultWebProxy="true">
      <readerQuotas maxDepth="32"
                    maxStringContentLength="2147483647"
                    maxArrayLength="2147483647"
                    maxBytesPerRead="2147483647"
                    maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>

</bindings>
<services>
  <service
    name="MyService"
    behaviorConfiguration="MyServiceBehavior">
    <endpoint address=""
              binding="basicHttpBinding"
              contract="IMyService"
              bindingConfiguration="MyBinding"/>
    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" policyVersion="Policy15" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

客户端上的WCF配置:

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="MyBinding" 
             maxReceivedMessageSize="2147483647" 
             maxBufferSize="2147483647" 
             maxBufferPoolSize="2147483647"
             receiveTimeout="00:02:00" 
             sendTimeout="00:02:00"
             useDefaultWebProxy="true">
      <readerQuotas maxDepth="32"            
                    maxStringContentLength="2147483647" 
                    maxArrayLength="2147483647" 
                    maxBytesPerRead="2147483647"            
                    maxNameTableCharCount="2147483647"/>
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint name="MyService"
            address="https://www.MyDomian.com/MyService.svc"
            binding="basicHttpBinding"
            contract="IMyService"
            bindingConfiguration="MyBinding"/>
</client>

到目前为止已经尝试过:

  • System.Net app配置元素,例如使用在Internet选项中定义的代理
  • 绑定的多个配置变体。未尝试其他绑定
  • process.Verb =“runas”
  • Fiddler2和WireShark显示没有隧道。 (当它连接时显示端口443上的HTTP隧道)
  • 检查了比赛条件,但找不到任何
  • 加载了正确的应用配置
  • 撞墙撞墙

更新1

  • 在Windows用户下运行Windows服务使引导程序连接,但由于这将是数百个外部客户的安装,我们将不会有这种奢侈。
  • 我在NETWORK SERVICE和LOCAL SERVICE下运行了该服务,但是bootstrapper只会退出异常。表示缺少特权的异常(当构造函数初始化变量时抛出异常)。
  • 我们后面的http代理使用.pac文件。尝试用system.net指向这个 - &gt; defaultProxy,没有运气。
  • 现在尝试一种不同的方法来强制引导程序使用特定的代理。

将此添加到WCF客户端配置

<system.net>
   <defaultProxy useDefaultCredentials="true">
       <proxy 
          proxyaddress="http://proxy.customerDomain.com:8080/" 
          bypassonlocal="True" 
          scriptLocation="http://config.customerDomain.com/proxy.pac"/>
   </defaultProxy>

我们错过了什么和/或对可能导致此问题的任何建议?

由于

0 个答案:

没有答案
相关问题