簡體   English   中英

C#不返回字節數組AMX Web服務

[英]c# not returning byte array asmx web service

我有一個在Visual Studio調試中運行良好的C#Web服務,但未在IIS中返回我的自定義調用的字節數組部分

IIS中Web服務的響應

<Surname>Midlton</Surname><Firstname>Katrin</Firstname><Middlename/><Gender>Female</Gender><MaritalStatus>Separated</MaritalStatus><DateOfBirth>7/1/1965 12:00:00 AM</DateOfBirth><Religion/><PermanentAddress>Oktabrjskaya</PermanentAddress><City>AKURE</City><State>IMO</State><Country>NG</Country><Nationality/><Occupation>ADVERTISING PRACTITIONER</Occupation><IDType/><IDNumber/><MobileNumber>98765432</MobileNumber><EmailAddress>sunstroke@mail.ttt</EmailAddress><IssueDebitCard>true</IssueDebitCard><PreferredName>1234567899876543211</PreferredName><EnableUDirect>0</EnableUDirect><UDirectUsername>1234567897</UDirectUsername><EnableEmailAlert>1</EnableEmailAlert><EnableEstatement>1</EnableEstatement><Title>Mrs.</Title><SolID>0280</SolID><CardType>Visa Dual Currency</CardType><EnableSMSAlert>1</EnableSMSAlert><RecordID>51008</RecordID><AccountTypeName>FREEDOM  SAVINGS  ACCOUNT  (BASIC)</AccountTypeName><AccountTypeID>3</AccountTypeID>

VS中的響應調試

<Surname>Midlton</Surname><Firstname>Katrin</Firstname><Middlename/><Gender>Female</Gender><MaritalStatus>Separated</MaritalStatus><DateOfBirth>7/1/1965 12:00:00 AM</DateOfBirth><Religion/><PermanentAddress>Oktabrjskaya</PermanentAddress><City>AKURE</City><State>IMO</State><Country>NG</Country><Nationality/><Occupation>ADVERTISING PRACTITIONER</Occupation><IDType/><IDNumber/><MobileNumber>98765432</MobileNumber><EmailAddress>sunstroke@mail.ttt</EmailAddress><IssueDebitCard>true</IssueDebitCard><PreferredName>1234567899876543211</PreferredName><EnableUDirect>0</EnableUDirect><UDirectUsername>1234567897</UDirectUsername><EnableEmailAlert>1</EnableEmailAlert><EnableEstatement>1</EnableEstatement><Title>Mrs.</Title><SolID>0280</SolID><CardType>Visa Dual Currency</CardType><EnableSMSAlert>1</EnableSMSAlert><RecordID>51008</RecordID><AccountTypeName>FREEDOM  SAVINGS  ACCOUNT  (BASIC)</AccountTypeName><AccountTypeID>3</AccountTypeID><UploadFile>dfdfEWESD345SDSDssDfdsf</UploadFile>

我真的很想知道為什么在IIS中刪除了響應的字節數組部分。

 AOData accountOpeningData = new AOData();         


                SqlCommand command = new SqlCommand(commandText);
                command.Connection = connection;



                reader = command.ExecuteReader();

                if (reader.Read())
                {
                    recordID = reader["RecordID"].ToString();
                    accountOpeningData.RecordID = recordID;
                    accountOpeningData.AccountTypeID = reader["AccountTypeID"].ToString();
                    accountOpeningData.AccountTypeName = reader["AccountTypeName"].ToString();
                    accountOpeningData.Surname = reader["LastName"].ToString();
                    accountOpeningData.Firstname = reader["FirstName"].ToString();
                    accountOpeningData.EmailAddress = reader["Email"].ToString();
                    accountOpeningData.Middlename = reader["MiddleName"].ToString();
                    accountOpeningData.Gender = reader["Gender"].ToString();
                    accountOpeningData.MaritalStatus = reader["MaritalStatus"].ToString();


                    accountOpeningData.DateOfBirth = reader["DOB"].ToString();
                    accountOpeningData.Religion = String.Empty; //reader["Religion"].ToString();
                    accountOpeningData.PermanentAddress = reader["Address"].ToString();
                    accountOpeningData.City = reader["City"].ToString();
                    accountOpeningData.State = reader["State"].ToString();
                    accountOpeningData.Country = reader["Country"].ToString();
                    accountOpeningData.Nationality = String.Empty; //reader["Nationality"].ToString();
                    accountOpeningData.Occupation = reader["Occupation"].ToString();
                    accountOpeningData.IDType = String.Empty; //reader["IdentificationForm"].ToString();
                    accountOpeningData.IDNumber = String.Empty; //reader["INumber"].ToString();
                    accountOpeningData.MobileNumber = reader["Tel1"].ToString();
                    accountOpeningData.IssueDebitCard = true; //Convert.ToBoolean(reader["SDebitcard"].ToString());
                    accountOpeningData.CardType = reader["CardType"].ToString();
                    accountOpeningData.PreferredName = reader["PreferedName"].ToString();
                    accountOpeningData.Title = reader["Title"].ToString();
                    accountOpeningData.SolID = reader["NewCode"].ToString();
                    accountOpeningData.EnableUDirect = reader["Udirect"].ToString();
                    accountOpeningData.UDirectUsername = reader["Uname"].ToString();
                    accountOpeningData.EnableEmailAlert = reader["EmailAlert"].ToString();
                    accountOpeningData.EnableSMSAlert = reader["SmsAlert"].ToString();
                    accountOpeningData.EnableEstatement = reader["eStatement"].ToString();

                    string code = reader["Code"].ToString();

                    accountOpeningData.UploadFile = GetUploadedFiles(code);


                }


            }
            catch (Exception ex)
            {
                // Print error message
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (reader != null)
                    reader.Close();

                if (connection.State == ConnectionState.Open)
                    connection.Close();
            }

            return accountOpeningData;
        }

我終於通過實現WSE 3.0解決了這個問題。 我按照這里的指示進行設置

並按照此處的說明將其添加到我的項目中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM