我的 WCF服务:
中出现以下错误System.ServiceModel.FaultException`1[WcfJMMLib.JMMPackage]: System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
经过几个小时的调试后,可以通过替换托管文件夹(指向IIS)中的配置文件或运行IISRESET命令来暂时解决该问题。一些电话再次重复此问题。替换给出错误的配置文件是什么。
配置文件
<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" behaviorConfiguration="servicebehavior">
<host>
<baseAddresses>
<!--<add baseAddress = "http://localhost:8733/Design_Time_Addresses/WcfJMMLib/Service1/" />-->
<add baseAddress = "http://mngnet371715d.ad.infosys.com/WcfJMMLib/Service1/" />
</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="basic" binding="basicHttpBinding" contract="WcfJMMLib.IService2"></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"/>
<!--<endpoint address="json" binding="webHttpBinding" behaviorConfiguration="restBehavior" name="webEndPoint" contract="WcfJMMLib.IService1"/>-->
</service>
</services>
</system.serviceModel>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
</defaultProxy>
<connectionManagement>
<add maxconnection = "100" address ="*" />
</connectionManagement>
</system.net>
</configuration>