我已经写了一个WCF服务。我面临的问题是服务发布后对服务的调用只能工作3-4次。之后,对服务的任何调用都会返回403错误。我检查了配置文件中的超时变量,并将它们设置为5分钟。但问题仍然存在。
配置文件(服务器端)
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="21474083647" closeTimeout="00:05:00" openTimeout="00:05:00" sendTimeout="00:05:00" receiveTimeout="00:03:00" >
<readerQuotas maxDepth="128" maxStringContentLength="83808608" maxArrayLength="2147483646" maxBytesPerRead="409600000" maxNameTableCharCount="163840000" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsBindingConfig" maxReceivedMessageSize="100000000" maxBufferPoolSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxArrayLength="100000000" maxBytesPerRead="409600000" maxNameTableCharCount="163840000"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name ="servicebehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restbehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WcfJMMLib.Service1">
<host>
<baseAddresses>
<add baseAddress = "http:address" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="soap" binding="basicHttpBinding" contract="WcfJMMLib.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="restbehavior" contract="WcfJMMLib.IService2"/>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
</defaultProxy>
<connectionManagement>
<add maxconnection = "100" address ="*" />
</connectionManagement>
</system.net>
</configuration>