Win32Exception @ ServiceHost.Open()for WCF服务 [英] Win32Exception @ ServiceHost.Open() for WCF service

查看:110
本文介绍了Win32Exception @ ServiceHost.Open()for WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为正在编写的一系列WCF服务基础结构编写BDD规范.我注意到,我编写的每个规范都涉及到对ServiceHost.Open()的调用,该行需要花费2到6秒钟才能执行(随着我添加越来越多的规范,时间不断增长).我注意到调用此方法时,将引发Win32Exception:

I am working on writing BDD specifications for a broad set of WCF service infrastructure I am writing. I have noticed that each specification I write that involves a call to ServiceHost.Open(), that line takes a good 2 - 6 seconds to execute (the time keeps growing as I add more and more specs). I noticed that when this method is called, a Win32Exception is thrown:

Win32Exception occurred
Message: The specified domain either does not exist or could not be contacted.
Stack Trace: at System.ServiceModel.UpnEndpointIdentity.GetUpnFromDownlevelName(String downlevelName)
NativeErrorCode: 1355
ErrorCode: -2147467259

ServiceModel配置如下:

The ServiceModel configuration is as follows:

<system.serviceModel>
  <services>
    <service name="TestServices.Calculator" behaviorConfiguration="default">
      <endpoint
        name="calculator"
        address=""
        binding="wsHttpBinding"
        contract="TestServiceContracts.ICalculator" />
      <endpoint
        address="mex"
        binding="mexHttpBinding"
        contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost/calculator" />
        </baseAddresses>
      </host>
    </service>
  </services>

  <behaviors>
    <serviceBehaviors>
      <behavior name="default" >
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

注意:我已经配置了Http.sys并添加了 http://+:80/calculator/作为http名称空间排除项,因此这不是问题的一部分.

Note: I have configured Http.sys and added http://+:80/calculator/ as an http namespace exclusion, so that is not part of the problem.

此错误在Windows 7 Ultimate系统上最严重.在Vista Ultimate系统上,它似乎不会对性能造成太大影响,但是ServiceHost.Open()是执行所花时间的绝大部分.我不明白为什么当URL为localhost时这根本不是问题...我希望环回接口是所有接口中最快的.

This error is most severe on a Windows 7 Ultimate system. On a Vista Ultimate system, it does not seem to cause as much of a performance hit, however ServiceHost.Open() is the vast bulk of the time spent in execution. I don't understand why it is an issue at all when the URL's are localhost...I would expect the loopback interface to be the fastest of all.

推荐答案

问题不在于localhost vs DNS名称...这与WCF调用

The problem isn't with localhost vs dns name... it's related to WCF calling the TranslateName() api to convert the UPN identity of the service from a SAM-compatible name (i.e DOMAIN\user) to a canonical name, and complaining that it cannot connect to the domain specified in the SAM-Compatible name presented as input.

不确定是什么原因造成的,但可能是您以某种方式在UPN标识中指定了错误的域,或者计算机的域注册有问题,或者防火墙正在挡住.

Not sure what might be causing this, but it could be that you're somehow specifying a wrong domain in your UPN identity, or there's something wrong with your machine's domain registration, or the firewall is getting in the way.

这篇关于Win32Exception @ ServiceHost.Open()for WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆