C# WCF如何在post方法中返回字节数组并读取字节内容以pdf格式打开

C# WCF如何在post方法中返回字节数组并读取字节内容以pdf格式打开,c#,wcf,C#,Wcf,WCF服务: public byte[] GetEsignContent(string LoanID) { string strConnection; strConnection = ConfigurationManager.AppSettings["SqlConn"]; WMSQLCon.DBSettings.ConnectionString = strConnection; byte[] bDocContent;

WCF服务:

public byte[] GetEsignContent(string LoanID)
    {

        string strConnection;
        strConnection = ConfigurationManager.AppSettings["SqlConn"];
        WMSQLCon.DBSettings.ConnectionString = strConnection;

        byte[] bDocContent;
        IAppUsers.GetDocContent(Convert.ToInt32(LoanID), out bDocContent);
        return bDocContent;

    }
客户端应用程序(aspx)


我无法获得在客户端应用程序的B内容中使用的确切二进制文件。请帮助我…

您能简要解释一下您试图实现的目标吗?是将PDF文件上载到WCF Rest服务还是从WCF Rest服务下载PDF文件?另外,请发布您的服务配置
 int LoanID = Convert.ToInt32(Request.QueryString["LoanID"]);
            string URL = "http://PS30/IAPPService/IApp.svc/IApp/GetEsignDocument/" + LoanID.ToString(); ;
            HttpWebRequest hwrProg = (HttpWebRequest)WebRequest.Create(URL);
            HttpWebResponse hwrpProg = (HttpWebResponse)hwrProg.GetResponse();
            StreamReader sr = new StreamReader(hwrpProg.GetResponseStream(), Encoding.ASCII);
           // string str = sr.ReadToEnd();
           // byte[] bcontent = Convert.FromBase64String(sr.ReadToEnd());
           //byte[] bcontent = Encoding.ASCII.GetBytes(sr.ReadToEnd());  
            Response.ContentType = "Application/pdf";
            Page.Response.AddHeader("Content-Disposition", "inline;filename=xxx.pdf");
            Response.AddHeader("content-length", bcontent.Length.ToString());
            Response.BinaryWrite(bcontent);
            Response.Flush();
            Response.Close();
            sr.Close();