WCF服务配置在IIS中不起作用。

问题描述 投票:0回答:1

我有一个WCF服务托管在IIS8中,在Windows8中,我使用framework 4.5,我试图根据文档添加端点,但是有一部分我不清楚,参数是什么意思。

<add baseAddress="http://localhost:808/Wcf_ProyectName/ClassServive.svc"/> 

你可以在下一个视频中看到细节。

https:/www.youtube.comwatch?v=b6wZhuOdzGQ&feature=youtu.be

不管怎么改值都不适用。这是我的配置完成。

    <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
<services>
<service name="Wcf_ProyectName.MiServiceName">
        <host>  
          <baseAddresses>  
            <add baseAddress="http://localhost:808/Wcf_ProyectName/MiServiceName.svc"/>  
          </baseAddresses>  
        </host> 
        <endpoint address="MiServiceName" binding="basicHttpBinding" contract="Wcf_ProyectName.IMiServiceName">          
        </endpoint>
      </service>
</services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- Para evitar revelar información de los metadatos, establezca los valores siguientes en false antes de la implementación -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- Para recibir detalles de las excepciones en los fallos, con el fin de poder realizar la depuración, establezca el valor siguiente en true. Para no revelar información sobre las excepciones, establézcalo en false antes de la implementación -->
          <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" />
    <!--
        Para examinar el directorio raíz de la aplicación web durante la depuración, establezca el valor siguiente en true.
        Establézcalo en false antes de la implementación para evitar revelar información sobre la carpeta de aplicación web.
      -->
    <directoryBrowse enabled="false" />
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="AlmacenDB" connectionString="server=.\WIN8R2;database=AlmacenDB;integrated security=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>
wcf wcf-binding
1个回答
0
投票

根据你的描述,我发现当你把服务发布到IIS上的时候,你的配置文件中仍然存在主机标签。只有windows服务这样的自主机或托管程序才需要配置host。当你在IIS中托管服务时,服务的基础地址由IIS中部署的端口号和服务的文件名组成。

enter image description here

这就是部署在IIS中的WCF服务的配置文件。

关于在IIS中部署WCF的详细情况,请参考以下链接。

WCF EF SQL Server VS2017 C# : 多层应用部署到本地IIS 10.0作为托管服务器时出现错误。

© www.soinside.com 2019 - 2024. All rights reserved.