C#을 처음 접했을 때 나는 머리를 들었다. 아마 나는 초보자 같은 물건을 보러 간다. 여기에 내 문제가있다 :CLR 길이 할당량 오류
나는 웹 서비스를 호출하는 CLR이있다. 웹 서비스에서 반환 된 데이터는 CLR가 처리하기에 너무 큰 가져온 후 다음과 같은 오류 발생 :
Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or
aggregate "fnGetReportData":
System.Web.Services.Protocols.SoapException:The formatter threw an exception
while trying to deserialize the message: There was an error while trying to
deserialize parameter http://tempuri.org/:xmlTags.
The InnerException message was 'There was an error deserializing the object of type
System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]. The maximum string content
length quota (8192) has been exceeded while reading XML data. This quota may be
increased by changing the MaxStringContentLength property on the
XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position
9474.'. Please see InnerException for more details.
System.Web.Services.Protocols.SoapException:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,
object[] parameters) at myService.RequestReport(String reportName, String[] xmlTags,
String encryptedUserName, String encryptedPassword)
at myReportClr.UserDefinedFunctions.fnGetReportData(SqlString reportName,
SqlString project, SqlXml reportTags, SqlString userName, SqlString password)
나는 비슷한 길이 할당량 오류가있는 다른 게시물의 일부를 보았다, 그러나 제안의 대부분의 변경과 관련 앱 구성. CLR을 사용하고 있기 때문에 앱 설정이 없으며 앱 설정을 추가 할 수 있는지 잘 모르겠습니다. 나는 LINK에있는 지침을 사용하여 하나를 추가하려고했으나 이는 CLR이 아닌 프로젝트를위한 것입니다.
도움을 주신 분께 감사드립니다. 미리 감사드립니다.
다음은 오류를 보완하는 코드 스 니펫입니다.
예외는 다음과 같은 함수 호출 내에서 SQL 서버 측에서 제공 :
SELECT @reportData = (dbo.fnGetReportData
('DataCompare'
,@projectName
,@harnessXmlTags
,@user
,@password)
);
아래의 코드는 # C에서입니다. 반환 된 XML이 너무 크고,이 게시물의 상단에 예외 결과 : 증가 될 필요가 MaxStringContentLength
라는 Web.config의 또는의 app.config의 설정이 있습니다
public static SqlXml fnGetReportData(
SqlString reportName
, SqlString project
, SqlXml reportTags
, SqlString userName
, SqlString password
)
{
String xmlResponse = " ";
SqlXml reportData = SqlXml.Null;
List<String> xmlTags = new List<String>();
xmlTags.Add(CreateTag("Project", project.ToString()));
xmlTags.Add(CreateTag("Configuration", "any"));
xmlTags.Add(reportTags.Value);
using (myService client = new myService())
{
xmlResponse =
client.RequestReport(reportName.ToString()
, xmlTags.ToArray()
, userName.ToString()
, password.ToString()
);
}
if (xmlResponse != null || !xmlResponse.Equals(""))
{
reportData = convertStringtoSqlXml(removeSoapHeader(xmlResponse, reportName.ToString()));
}
else
{
reportData = convertStringtoSqlXml(
String.Format("{0} xmlns:xsi=\"www.myReport.com/myData\" xmlns:ns=\"uri\"", reportName)
);
}
return reportData;
}
확인하려면 'CLR'이라고 말하면 SQL Server 내의 CLR 저장 프로 시저를 말하는 것입니까? – Paddy
제공된 지침이 작동하지 않았습니까? *이 할당량은 일 수 있습니다. XML 판독기를 만들 때 사용되는 XmlDictionaryReaderQuotas 개체가 MaxStringContentLength 속성을 변경합니다. * –
"CLR 사용"의 의미가 확실하지 않습니다. 나에게 이것은 * Common Language Runtime, * 나는 C#의 어떤 작가도 사용하고 있다고 가정한다. – Jacob