c#没有返回字节数组asmx web服务

时间:2016-03-29 09:34:15

标签: c# web-services iis bytearray asmx

我有一个C#Web服务在Visual Studio Debug中运行良好,但不会在IIS中返回自定义调用的bytearray部分

来自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中删除了响应的bytearray部分。

 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;
        }

1 个答案:

答案 0 :(得分:0)

我终于通过实施WSE 3.0解决了这个问题。我按照here

的指示进行了设置

并按照说明here将其添加到我的项目中