我正在尝试创建并配置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)