本文介绍了配置XML-RPC行为IIS托管.SVC文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的终结点行为,如下所示:

I've attempted to configure an endpoint behavior in Web.config, as follows:

<system.serviceModel>
  <services>
    <service name="AnotherBlogEngine.Web.Api.BlogApi">
      <endpoint address=""
                binding="webHttpBinding"
                contract="AnotherBlogEngine.Web.Api.IBlogApi"
                behaviorConfiguration="xmlRpcBehavior" />
  </service>
  </services>
  <extensions>
    <behaviorExtensions>
      <add name="xmlRpc"
           type="AnotherBlogEngine.XmlRpc.XmlRpcEndpointBehaviorElement, \
                 AnotherBlogEngine.XmlRpc" />
    </behaviorExtensions>
  </extensions>
  <behaviors>
    <endpointBehaviors>
      <behavior name="xmlRpcBehavior">
        <xmlRpc/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

...但它不工作。我究竟做错了什么?我有我的web.config正确的,还是我拥有这一切完全错了吗?我需要在我的.SVC文件中提供的自定义工厂理清行为?

...but it's not working. What am I doing wrong? Do I have my Web.config correct, or do I have it all completely wrong? Do I need to provide a custom factory in my .SVC file to sort out the behaviors?

.svc文件看起来是这样的,顺便说一句:

The .SVC file looks like this, by the way:

<%@ ServiceHost Language="C#" Debug="true"
    Service="AnotherBlogEngine.Publishing.Service.BlogApi, \
             AnotherBlogEngine.Publishing.Service" %>

注意:那些反斜杠并不居然有;他们只是为换行。

Note: Those backslashes aren't actually there; they're just for line-wrapping.

此外,在那一刻,我只是在卡西尼(VS2010),而不是IIS测试这一点,但我会在IIS 7.x的目光瞄准它。

Also, at the moment, I'm just testing this in Cassini (VS2010), rather than IIS, but I'll be aiming it at IIS 7.x.

更新:这肯定至少在看我的扩展:它调用 XmlRpcEndpointBehaviorElement.get_BehaviorType ,如果 XmlRpcEndpointBehavior 不执行 IEndpointBehavior ,我得到一个错误,该效应(代替了你已经创建了一个服务页面的显示)。

Update: It's definitely at least looking at my extension: it calls XmlRpcEndpointBehaviorElement.get_BehaviorType, and if XmlRpcEndpointBehavior doesn't implement IEndpointBehavior, I get an error to that effect (displayed in place of the "You have created a service" page).

不过,在任一类中的其他方法的断点不被打到。

However, breakpoints on the other methods in either class don't get hit.

如果我打开WCF的跟踪,我在日志文件中看到无法识别的消息版本。

If I turn on WCF tracing, I see "unrecognized message version" in the log file.

推荐答案

下面是得到这个工作的步骤:

Here are the steps to get this working:


  1. 下载下载我的测试解决方案。

    Tested with Windows Live Writer and the console client application. You can download my test solution from here.

    这篇关于配置XML-RPC行为IIS托管.SVC文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 06:39
查看更多