微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Silverlight中WCF在添加引用中不能发现的问题

Silverlight中WCF在添加引用中不能发现的问题

1.开始以为是项目添加到VSS中,文件只读导致的,把所有只读都检查了一遍后,发现问题依旧
2.上网查了一下,说是配置文件有问题,结果检查Web.config文件,发现文件内容如下
   <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
            <customBinding>                                             //这个customBinding其实是不需要的
                <binding name="Paimport.Web.wcfMain.customBinding0">
                    <binaryMessageEncoding />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />
        <services>
            <service name="Paimport.Web.wcfMain">
                <endpoint address="" binding="customBinding" bindingConfiguration="Paimport.Web.wcfMain.customBinding0"
                    contract="Paimport.Web.wcfMain" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>
    </system.serviceModel>

发现配置文件多了很多东西,结果找了一个项目,可以正常发现WCF的项目,看了一下web.config文件 发现,注意是<system.serviceModel>这一段,根本不需要那么多东西,直接用下面的内容替换掉,重新生成后, WCF就能在项目中成功发现了     <system.serviceModel>         <behaviors>             <serviceBehaviors>                 <behavior name="">                     <serviceMetadata httpGetEnabled="true" />                     <serviceDebug includeExceptionDetailInFaults="false" />                 </behavior>             </serviceBehaviors>         </behaviors>         <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />     </system.serviceModel>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐