zoukankan      html  css  js  c++  java
  • wcf第2步之服务端标准配置文件

    服务端app.config

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.serviceModel>
    <services>
    <service name="WCFTest.GreetService" behaviorConfiguration="GreetServiceBehavior">
    <host>
    <baseAddresses>
    <add baseAddress = "http://localhost:20000/" />
    </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding" contract="WCFTest.IGreetService" >

    </endpoint>
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior name="GreetServiceBehavior">
    <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
    <serviceMetadata httpGetEnabled="true"/>
    <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
    <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
    </configuration>

    class Program
    {
    static void Main(string[] args)
    {
    ServiceHost host = new ServiceHost(typeof(GreetService)); 
    host.Open();
    Console.WriteLine("服务已开启");
    Console.Read();
    }
    }

    [ServiceContract]
    public interface IGreetService
    {
    [OperationContract]
    string Greet(string name);

    }

    public class GreetService : IGreetService
    {

    public string Greet(string name)
    {
    Console.WriteLine(("Hello:"+name));
    return "Welcome:" + name;
    }
    }

  • 相关阅读:
    再谈H2的MVStore与MVMap
    log4j动态日志级别调整
    wireshark抓文件上传的包的结果记录
    struts2对properties资源的处理
    Spring core resourc层结构体系及JDK与Spring对classpath中资源的获取方式及结果对比
    [工具使用] visualvm 通过jmx不能连接
    oracle 安装 启动listener 建库相关
    vscode
    XSSFWorkbook
    TearmQuery()
  • 原文地址:https://www.cnblogs.com/zhshlimi/p/5594564.html
Copyright © 2011-2022 走看看