在通过程序将XML中数据读入DATASET,然后将DATASET 通过WEBSERVICE更新SQL2005数据,出现下面错误。
/////////////////////////////////////////////////////////////////////////System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: 运行配置文件中指定的扩展时出现异常。 ---> System.Web.HttpException: 超过了最大请求长度。
在 System.Web.HttpRequest.GetEntireRawContent()
在 System.Web.HttpRequest.get_InputStream()
在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
在 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
在 fdcclient.server.Service.UpdateDataSet(String SQLString, String TableName, DataSet ds) 位置 C:\fdc\fdcclient\fdcclient\Web References\server\Reference.cs:行号 281
在 fdcclient.Sub.Xtwh.ArchivesImportFrm.btn_OK_Click(Object sender, EventArgs e) 位置 C:\fdc\fdcclient\fdcclient\Sub\Xtwh\ArchivesImportFrm.cs:行号 257/////////////////////////////////////////////////是我的WEB.CONFIG出问题吗?,咋办呢?
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/> <connectionStrings>
<add name="ConnectionString" connectionString="Data Source=server;Initial Catalog=fdc;Persist Security Info=True;User ID=sa;Password=txysoft"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
设置 compilation debug="true" 将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<compilation debug="true"/>
<!--
通过 <authentication> 节可以配置 ASP.NET 使用的
安全身份验证模式,
以标识传入的用户。
-->
<authentication mode="Windows"/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
--> <webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
</system.web>
</configuration>
我的客户端的程序代码:
namespace fdcclient.Sub.Xtwh
{
public partial class ArchivesImportFrm : Form
{
public ArchivesImportFrm()
{
InitializeComponent();
}
fdcclient.server.Service service1 = new fdcclient.server.Service(); //DataSet DSBackupTable = new DataSet();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
#region 导入 按钮 private void btn_OK_Click(object sender, EventArgs e)
{
try
{
this.richTextBox1.Text = ""; //清空
this.richTextBox2.Text = "本次成功的导入了以下业务编号:\n***********************************\n"; //清空
this.progressBar1.Visible = true;
this.lb_Wait.Visible = true;
ProgressBarStart(); #region 初始化 取得 即将导入到最终表 得各个DATASET
DataSet DSBuildTable = new DataSet(); //基础表
DataSet DSCHTable = new DataSet(); //测绘表
DataSet DSBaseTable = new DataSet(); //楼房表
DataSet DSShareTable = new DataSet(); //共有权表
DataSet DSSJTable = new DataSet(); //收件内容表 DataSet DSDYTable = new DataSet(); //抵押表
DataSet DSDYBuildTable = new DataSet(); //抵押楼房表 DSBaseTable = service1.Query("select * from 基础表 ", "基础表");
DSCHTable = service1.Query("select * from 测绘表 ", "测绘表");
DSBuildTable = service1.Query("select * from 楼房表 ", "楼房表");
DSShareTable = service1.Query("select * from 共有权表 ", "共有权表");
DSSJTable = service1.Query("select * from 收件内容表 ", "收件内容表");
DSDYTable = service1.Query("select * from 抵押表 ", "抵押表");
DSDYBuildTable = service1.Query("select * from 抵押楼房表 ", "抵押楼房表"); #endregion #region 找出业务编号的总数 rowsCount_ywbh 和业务编号的列表ywbh_Array[i]
int rowsCount_ywbh = DSBaseTable.Tables["基础表"].Rows.Count; //总业务编号的个数
string[] ywbh_Array = new string[rowsCount_ywbh]; //本地数据库中的所有业务编号
for (int i = 0; i < rowsCount_ywbh; i++)
{
ywbh_Array[i] = DSBaseTable.Tables["基础表"].Rows[i]["业务编号"].ToString().Trim();
}
#endregion this.richTextBox1.Text += "\n" + "导入前:本档案数据库中的业务编号的条数为:" + rowsCount_ywbh.ToString(); //提示
this.richTextBox1.Text += "\n" + "******************************************"; //开始导入备份表XML
openFileDialog1.Filter = "XML Files (*.xml) | *.xml";
openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ DataSet DSBackupTable = new DataSet();
DSBackupTable.ReadXml(openFileDialog1.FileName, XmlReadMode.ReadSchema); //读入XML数据
#region 基础表 <将不存在的记录行 merge 到当前DATASET>
foreach (DataRow oRow in DSBackupTable.Tables["基础表"].Rows)
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSBaseTable.Tables["基础表"].Rows.Add(oRow.ItemArray);
///////////////////
this.richTextBox2.Text += "\n" + oRow["业务编号"].ToString().Trim();
/////////////////////
} }
#endregion
#region 测绘表 <将不存在的记录行 merge 到当前DATASET> //
foreach (DataRow oRow in DSBackupTable.Tables["测绘表"].Rows) //
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSCHTable.Tables["测绘表"].Rows.Add(oRow.ItemArray); // //
} } #endregion #region 楼房表 <将不存在的记录行 merge 到当前DATASET> //
foreach (DataRow oRow in DSBackupTable.Tables["楼房表"].Rows) //
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSBuildTable.Tables["楼房表"].Rows.Add(oRow.ItemArray); // //
} } #endregion
#region 共有权表 <将不存在的记录行 merge 到当前DATASET> //
foreach (DataRow oRow in DSBackupTable.Tables["共有权表"].Rows) //
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSShareTable.Tables["共有权表"].Rows.Add(oRow.ItemArray); // //
} } #endregion
foreach (DataRow oRow in DSBackupTable.Tables["收件内容表"].Rows) //
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSSJTable.Tables["收件内容表"].Rows.Add(oRow.ItemArray); // //
} } #endregion string[] dybh_Array = new string[DSBackupTable.Tables["抵押表"].Rows.Count]; //本地数据库中符合增加导入的抵押编号列表
int dybh_Index = 0; #region 抵押表 <将不存在的记录行 merge 到当前DATASET> //
foreach (DataRow oRow in DSBackupTable.Tables["抵押表"].Rows) //
{
string temp_ywbh = oRow["业务编号"].ToString().Trim();
bool temp_flag = true;
for (int j = 0; j < rowsCount_ywbh; j++)
{
if (ywbh_Array[j] == temp_ywbh)
{
temp_flag = false;
}
}
if (temp_flag)
{
DSDYTable.Tables["抵押表"].Rows.Add(oRow.ItemArray); // // ///////////
dybh_Array[dybh_Index] = oRow["抵押编号"].ToString().Trim(); dybh_Index++;
////////////////
} } #endregion
#region 抵押楼房表 <将不存在的记录行 merge 到当前DATASET> //
foreach (DataRow oRow in DSBackupTable.Tables["抵押楼房表"].Rows) //
{
string temp_dybh = oRow["抵押编号"].ToString().Trim();
bool temp_flag = false;
for (int j = 0; j < dybh_Index; j++)
{
if (dybh_Array[j] == temp_dybh)
{
temp_flag = true;
}
}
if (temp_flag)
{
DSDYBuildTable.Tables["抵押楼房表"].Rows.Add(oRow.ItemArray); // //
} } #endregion
#region 开始 UPDATE 各个表DATASET
//基础表
bool flag1 = service1.UpdateDataSet("select * from 基础表 ", "基础表", DSBaseTable);
if (!flag1)
{ this.richTextBox1.Text += "\n1.基础表更新失败!"; }
else
{ this.richTextBox1.Text += "\n1.基础表更新成功!"; } //测绘表
bool flag2 = service1.UpdateDataSet("select * from 测绘表 ", "测绘表", DSCHTable);
if (!flag2)
{ this.richTextBox1.Text += "\n2.测绘表更新失败!"; }
else
{ this.richTextBox1.Text += "\n2.测绘表更新成功!"; } //楼房表
bool flag3 = service1.UpdateDataSet("select * from 楼房表 ", "楼房表", DSBuildTable);
if (!flag3)
{ this.richTextBox1.Text += "\n3.楼房表更新失败!"; }
else
{ this.richTextBox1.Text += "\n3.楼房表更新成功!"; }
//共有权表
bool flag4 = service1.UpdateDataSet("select * from 共有权表 ", "共有权表", DSShareTable);
if (!flag4)
{ this.richTextBox1.Text += "\n4.共有权表更新失败!"; }
else
{ this.richTextBox1.Text += "\n4.共有权表更新成功!"; }
//收件内容表
bool flag5 = service1.UpdateDataSet("select * from 收件内容表 ", "收件内容表", DSSJTable);
if (!flag5)
{ this.richTextBox1.Text += "\n5.收件内容表更新失败!"; }
else
{ this.richTextBox1.Text += "\n5.收件内容表更新成功!"; }
//抵押表
bool flag6 = service1.UpdateDataSet("select * from 抵押表 ", "抵押表", DSDYTable);
if (!flag6)
{ this.richTextBox1.Text += "\n6.抵押表更新失败!"; }
else
{ this.richTextBox1.Text += "\n6.抵押表更新成功!"; }
//抵押楼房表
bool flag7 = service1.UpdateDataSet("select * from 抵押楼房表 ", "抵押楼房表", DSDYBuildTable);
if (!flag7)
{ this.richTextBox1.Text += "\n7.抵押楼房表更新失败!"; }
else
{ this.richTextBox1.Text += "\n7.抵押楼房表更新成功!"; } #endregion
this.richTextBox1.Text += "\n" + "******************************************";
this.richTextBox1.Text += "\n" + "导入结束:本档案数据库中的业务编号的条数为:" + DSBaseTable.Tables["基础表"].Rows.Count.ToString(); //提示
} //end if
}
catch (Exception ex)
{ this.richTextBox1.Text = "要导入的备份数据有问题、或数据库出问题,发生异常...."; this.richTextBox2.Text = ex.ToString(); }
finally
{
this.progressBar1.Visible = false;
this.lb_Wait.Visible = false;
}
}
#endregion
//进度条演示
.......略 }}}
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: 运行配置文件中指定的扩展时出现异常。 ---> System.Web.HttpException: 超过了最大请求长度。
在 System.Web.HttpRequest.GetEntireRawContent()
在 System.Web.HttpRequest.get_InputStream()
在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
在 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
在 fdcclient.server.Service.UpdateDataSet(String SQLString, String TableName, DataSet ds) 位置 C:\fdc\fdcclient\fdcclient\Web References\server\Reference.cs:行号 281
在 fdcclient.Sub.Xtwh.ArchivesImportFrm.btn_OK_Click(Object sender, EventArgs e) 位置 C:\fdc\fdcclient\fdcclient\Sub\Xtwh\ArchivesImportFrm.cs:行号 257/////////////////////////////////////////////////我感觉可能是WEB.CONFIG的问题,不知道是何原因?