1

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)

 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();

我无法获得在客户端应用程序的 bcontent 中提供服务的确切二进制文件..请帮助我...

4

0 回答 0