zoukankan      html  css  js  c++  java
  • ImageUploadAssist——Interface

    IUploadImageService.cs

    /// <summary>
            /// 图片上传接口
            /// </summary>
            /// <param name="uploadImageData"></param>
            /// <returns></returns>
            [OperationContract]
            [WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "Upload_ImageInterface")]
            dataresult UploadImageInterface(System.IO.Stream uploadImageData);
    
            /// <summary>
            /// 缩略图接口
            /// </summary>
            /// <param name="uploadThumbnailImageData"></param>
            /// <returns></returns>
            [OperationContract]
            [WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "Upload_ThumbnailInterface")]
            dataresult UploadThumbnailInterface(System.IO.Stream uploadThumbnailImageData);

    UploadImageService.svc

    public dataresult UploadImageInterface(System.IO.Stream uploadImageData)
            {
    
                return new Biz_UploadImage().UploadImageInterface(uploadImageData, GetEndpoint().Address);
            }
    
    
            public dataresult UploadThumbnailInterface(System.IO.Stream uploadThumbnailImageData)
            {
                return new Biz_UploadImage().UploadThumbnailInterface(uploadThumbnailImageData, GetEndpoint().Address);
            }
    
            private RemoteEndpointMessageProperty GetEndpoint()
            {
                //提供方法执行的上下文环境
                OperationContext context = OperationContext.Current;
                //获取传进的消息属性
                MessageProperties properties = context.IncomingMessageProperties;
                //获取消息发送的远程终结点IP和端口
                return properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
    
                //可以尝试利用OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name 来获取调用者的域名。它返回的格式是"{domain}{username}"。
    
                //ServiceSecurityContext.Anonymous. context.ServiceSecurityContext.PrimaryIdentity.Name
            }
  • 相关阅读:
    angular手势事件之on-Hold
    angular 控制器的使用两种模式
    关于IONIC 报错 XX is not a function
    ionic 中$ionicView.beforeEnter 事件的一个bug
    开发一个IONIC应用的首要操作(宏观)
    在线常用库 + API手册
    关于日历实现代码里lunarInfo(农历)数组
    YSlow
    GET and POST
    Yahoo34条军规——雅虎WEB前端网站优化
  • 原文地址:https://www.cnblogs.com/FH-cnblogs/p/5711619.html
Copyright © 2011-2022 走看看