zoukankan      html  css  js  c++  java
  • vs2010 wcf 服务引用出错。

    点击发现,可以发现服务,但是无法添加引用

    Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.

    我使用的 vs.net 2010 

    有两种解决办法:(在添加引用前,请先保证已经编译过。修改后,也需要再次编译。)

    1、给服务添加上特性:

    首先需要添加引用:

    using System.ServiceModel.Activation
    在添加特性:
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    public class MyService : IMyService

    2、修改web.configure文件

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />

    将aspNetCompatibilityEnabled 修改为false

    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior name="">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
    </system.serviceModel>

  • 相关阅读:
    Springsecurity3.1.3配置多个登陆页面
    将数字转换为大写(保留小数点后面2位)
    纯JavaScript实现的二维码图片生成器
    poi导出excel
    发送邮件
    Lodop实现打印功能
    遍历list
    循环监听输入框回车事件
    监听回车事件记录
    简单的事务操作过程
  • 原文地址:https://www.cnblogs.com/lingfengchencn/p/2016639.html
Copyright © 2011-2022 走看看