问题
EDIT: SOLUTION in the comment!
I have to offer a SOAP service. He indicates a HTTP-403 error. I need access to the http://10.234.35.19:80/?wsdl and the API SPAPort.
Therefore, I assume that either my configuration is wrong or the file permissions on the folder. Which user does one have to give read access to a server? Maybe the should be replaced with service?
The code below shows the production environment:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics> -->
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SPASoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.234.35.19:80/" binding="basicHttpBinding"
bindingConfiguration="SPASoapBinding" contract="SPAPortType"
name="SPAPort" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
This trial worked but I didn't reached access from another computer (only from local). Please note that access is now only possible via the svc file.:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
EDIT: The locally working Web.config file has the following error on an client (the web server shows nothing):
bei System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
bei System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
bei System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
bei System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
bei System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
bei System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
bei System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
bei System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
bei System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
bei System.ServiceModel.ClientBase`1..ctor()
bei KOS_Tester.ServiceReference1.KOSPortTypeClient..ctor()
bei KOS_Tester.Form1.serverKOSAusführen(String strPfadRequest)Es wurde kein standardmäßiges Endpunktelement gefunden, das auf den Vertrag "ServiceReference1.KOSPortType" im ServiceModel-Clientkonfigurationsabschnitt verweist. Dies kann folgende Ursachen haben: Für die Anwendung wurde keine Konfigurationsdatei gefunden, oder im Clientelement wurde kein Endpunktelement gefunden, das diesem Vertrag entsprach.
Translated:
No default endpoint element was found that points to the ServiceReference1.KOSPortType contract in the ServiceModel client configuration section. This document has no set-file element, no contract file found.
The other Web.config-file throws no specific 403-error.
I uploaded my project: https://www.dropbox.com/s/81em9slycdb4wnk/WcfService6.zip?dl=0&m=
来源:https://stackoverflow.com/questions/58076452/iis-10-how-can-i-solve-403-in-the-production-environment