System.IO.DirectoryNotFoundException в веб-службе WCF - PullRequest
0 голосов
/ 15 апреля 2020

Я создаю веб-сервис WCF. Итак, у меня есть пример в Github. Пример проекта Я могу скомпилировать проект. Но я получаю ошибку System.IO.DirectoryNotFoundException.

Мой URL: http://127.0.0.1: 8080 / v1 / HelloService.svc /

Моя IDE: Visual Studio 2019 MA C

enter image description here

web. xml

<?xml version="1.0"?>
<configuration>

<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
  <serviceActivations>
    <add relativeAddress="v1/HelloService.svc"
         service="FilelessActivation.Services.HelloServiceImpl"
         factory="System.ServiceModel.Activation.ServiceHostFactory" />
  </serviceActivations>
</serviceHostingEnvironment>
<services>
  <service name="FilelessActivation.Services.HelloServiceImpl">
    <endpoint binding="basicHttpBinding" 
              bindingNamespace="http://oscarkuo.com/v1/hello" 
              contract="FilelessActivation.Services.IHelloService" />
  </service>  
</services> 
</system.serviceModel>
<system.webServer>
 <modules runAllManagedModulesForAllRequests="true"/>
  <directoryBrowse enabled="true"/>
</system.webServer>

</configuration>

1 Ответ

0 голосов
/ 16 апреля 2020

Причина root в том, что мы должны включить функцию Windows для поддержки расширения SV C в IIS. Впоследствии этот сервис мог бы работать.
enter image description here
Кроме того, обратите внимание, что в проекте WCF файл «Нет необходимости» SVC не означает, что относительный адрес в ServiceActivations не содержит SVC расширение.
Результат.
enter image description here
Ссылки по теме.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuration-based-activation-in-iis-and-was
Не стесняйтесь, дайте мне знать, если проблема все еще существует.

...