powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Не выставляется значение maxStringContentLength в WCF
6 сообщений из 6, страница 1 из 1
Не выставляется значение maxStringContentLength в WCF
    #37010493
stenford
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Весь мозг уже сломал, вот конфиг сервиса:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
<system.serviceModel>

    <bindings>      
      <wsHttpBinding>
        <binding name="WSHttpBinding_IFile" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483646" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
        </binding>
      </wsHttpBinding>
      
    </bindings>
    
    <services>
   <service behaviorConfiguration="ServiceBehavior" name="File">
    <endpoint address="" binding="wsHttpBinding" contract="IFile">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>
		<behaviors>
			<serviceBehaviors>
				<behavior name="ServiceBehavior">
					<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
					<serviceMetadata httpGetEnabled="true" />
					<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
					<serviceDebug includeExceptionDetailInFaults="true" />
				</behavior>
			</serviceBehaviors>
		</behaviors>
	</system.serviceModel>
а вот клиента:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
<system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IFile" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646"                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />

                 

                  <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="">
                            <extendedProtectionPolicy policyEnforcement="Never" />
                        </transport>
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="server/File.svc"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFile"
                contract="ServiceReference1.IFile" name="WSHttpBinding_IFile">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
при попытке передать большое строковое значение выкидывается эксепшн: "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. "
А вроде везде указал значение maxStringContentLength = 2147483646, где-то еще нужно прописывать?
...
Рейтинг: 0 / 0
Не выставляется значение maxStringContentLength в WCF
    #37010508
Denis Gladkikh
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
stenford,

а как сервис на клиенте создаете? в смысле код, который инициализирует прокси для сервисов.
...
Рейтинг: 0 / 0
Не выставляется значение maxStringContentLength в WCF
    #37010524
Denis Gladkikh
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
stenford,

и посмотрите у вас в endpoint для серверной конфигурации не указана bindingConfiguration="WSHttpBinding_IFile"
...
Рейтинг: 0 / 0
Не выставляется значение maxStringContentLength в WCF
    #37010563
stenford
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Denis Gladkikh а как сервис на клиенте создаете? в смысле код, который инициализирует прокси для сервисов.
просто обьявляю переменную:
Код: plaintext
Dim WCFService As ServiceReference1.FileClient = New ServiceReference1.FileClient()
(если это то, что имеете ввиду)

Denis Gladkikhи посмотрите у вас в endpoint для серверной конфигурации не указана bindingConfiguration="WSHttpBinding_IFile"

когда гуглил по этой ошибке, то тоже пару раз встречались подобные советы, но я не могу понять где в web.config нужно это указать. Вот конфиг сервиса целиком, где и как надо указывать эту опцию? :

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->


<configuration>


  <configSections>
    
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>

 
  <system.web>
		<!--
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
		<compilation debug="true" strict="false" explicit="true">
			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
			</assemblies>
		</compilation>
		<pages>
			<namespaces>
				<clear />
				<add namespace="System" />
				<add namespace="System.Collections" />
				<add namespace="System.Collections.Specialized" />
				<add namespace="System.Configuration" />
				<add namespace="System.Runtime.Serialization" />
				<add namespace="System.ServiceModel" />
				<add namespace="System.Text" />
				<add namespace="System.Text.RegularExpressions" />
				<add namespace="System.Linq" />
				<add namespace="System.Web" />
				<add namespace="System.Web.Caching" />
				<add namespace="System.Web.SessionState" />
				<add namespace="System.Web.Security" />
				<add namespace="System.Web.Profile" />
				<add namespace="System.Web.UI" />
				<add namespace="System.Web.UI.WebControls" />
				<add namespace="System.Web.UI.WebControls.WebParts" />
				<add namespace="System.Web.UI.HtmlControls" />
			</namespaces>
			<controls>
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			</controls>
		</pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows" />
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
		<httpHandlers>
			<remove verb="*" path="*.asmx" />
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
		</httpHandlers>
		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
		</httpModules>
	</system.web>
	<system.codedom>
		<compilers>
			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5" />
				<providerOption name="WarnAsError" value="false" />
			</compiler>
			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5" />
				<providerOption name="OptionInfer" value="true" />
				<providerOption name="WarnAsError" value="false" />
			</compiler>
		</compilers>
	</system.codedom>
 <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services  7 . 0 .  It is not necessary for previous version of IIS.
    -->
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false" />
		<modules>
			
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated" />
			
			
			
		</handlers>
        <directoryBrowse enabled="true" />
	</system.webServer>
	<system.serviceModel>

    <bindings>      
      <wsHttpBinding>
        <binding name="WSHttpBinding_IFile" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483646" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
        </binding>
      </wsHttpBinding>
      
    </bindings>
    
    <services>
   <service behaviorConfiguration="ServiceBehavior" name="File">
    <endpoint address="" binding="wsHttpBinding" contract="IFile">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>
		<behaviors>
			<serviceBehaviors>
				<behavior name="ServiceBehavior">
					<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
					<serviceMetadata httpGetEnabled="true" />
					<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
					<serviceDebug includeExceptionDetailInFaults="true" />
				</behavior>
			</serviceBehaviors>
		</behaviors>
	</system.serviceModel>


</configuration>
...
Рейтинг: 0 / 0
Не выставляется значение maxStringContentLength в WCF
    #37011073
Denis Gladkikh
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
stenford,

в северной конфигурации в этой вот части

Код: plaintext
1.
2.
3.
4.
 <endpoint address="" binding="wsHttpBinding" contract="IFile">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>

добавляем bindingConfiguration="WSHttpBinding_IFile"

Код: plaintext
1.
2.
3.
4.
<endpoint address="" binding="wsHttpBinding" contract="IFile" bindingConfiguration="WSHttpBinding_IFile">
     <identity>
      <dns value="localhost" />
     </identity>
</endpoint>
...
Рейтинг: 0 / 0
Не выставляется значение maxStringContentLength в WCF
    #37012527
stenford
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Спасибо, заработало. Странно что по умолчанию это не генерируется
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Не выставляется значение maxStringContentLength в WCF
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]