小编Jon*_*ree的帖子

在WCF REST 4.0中使用StandardEndpoints时如何配置MessageInspector

我正在尝试创建并配置Message Inspector以执行WCF Rest HTTP请求的某些身份验证.我正在使用4.0,所以我试图避开WCF入门套件,尽管我已经设法让我的旧RequestInterceptor以我想要的方式工作.使用RequestInterceptor的问题是我丢失了WebHttpBehavior提供的automaticFormatSelectionEnabled功能,我真的想保留它.

所以我的问题是如何配置Message Inspector,我仍然使用WebHttpBehavior并保留它的功能.

我的web.config看起来像这样

    <standardEndpoints>
  <webHttpEndpoint>
    <!-- the "" standard endpoint is used by WebServiceHost for auto creating a web endpoint. -->
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
    <!-- Disable the help page for the directory end point-->
    <standardEndpoint name="DirectoryEndpoint"/>
  </webHttpEndpoint>
</standardEndpoints>
Run Code Online (Sandbox Code Playgroud)

wcf message behavior inspector

9
推荐指数
1
解决办法
8161
查看次数

标签 统计

behavior ×1

inspector ×1

message ×1

wcf ×1