zoukankan      html  css  js  c++  java
  • 托管在IIS上的wcf,在启动的时候,写log

    https://blogs.msdn.microsoft.com/wenlong/2006/01/11/how-to-initialize-hosted-wcf-services/

    Using AppInitialize

    The above global.asax does not work for non-HTTP protocols such as net.tcp and net.pipe that is supported by the Windows Activation Service (WAS) on Windows Vista. There is no protocol-agnostic counterpart for HttpApplication in this case.

     

    Fortunately, ASP.NET provides a simple hook that works in a protocol agnostic way. The hook is based on the following AppInitialize method:

        public static void AppInitialize();

    This method can be put in any type that is defined in a C# file in the application’s App_Code directory. When the AppDomain is started, ASP.NET checks whether there is a type that has such as method (exact name and signature) and invokes it. Note that the AppInitialize method can be only defined once and it has to be in a code file instead of a pre-compiled assembly.

    将此文件集成到wcf发布的library

    右键选中文件,然后properties,将BuildAction设置为Compile

  • 相关阅读:
    List sort()方法
    解析器
    beautifulsoup库
    break 语句
    enumerate函数
    POJ 1915 Knight Moves
    POJ 1745 Divisibility
    POJ 1731 Orders
    POJ 1664 放苹果
    POJ 1606 Jugs
  • 原文地址:https://www.cnblogs.com/chucklu/p/8795429.html
Copyright © 2011-2022 走看看