РЕДАКТИРОВАТЬ: РЕШЕНИЕ в комментарии!
Я должен предложить сервис SOAP.Он указывает на ошибку HTTP-403.Мне нужен доступ к http://10.234.35.19:80/?wsdl и API SPAPort.
Поэтому я предполагаю, что либо моя конфигурация неверна, либо права доступа к файлу для папки.Какой пользователь должен предоставить доступ на чтение к серверу?Может быть, его следует заменить службой?
В приведенном ниже коде показана производственная среда:
<?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>
Эта пробная версия сработала, но я не получил доступ с другого компьютера (только с локального компьютера).Обратите внимание, что теперь доступ возможен только через файл svc .:
<?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>
РЕДАКТИРОВАТЬ: локально работающий файл Web.config имеет следующую ошибку на клиенте (веб-сервер ничего не показывает):
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.
Переведено:
Не найден элемент конечной точки по умолчанию, который указывает на контракт ServiceReference1.KOSPortType в разделе конфигурации клиента ServiceModel.В этом документе нет элемента set-file, файл контракта не найден.
В другом файле Web.config отсутствует конкретная ошибка 403.
Я загрузил свой проект: https://www.dropbox.com/s/81em9slycdb4wnk/WcfService6.zip?dl=0&m=