在 IIS 中托管 Web 服务 - 无法访问该服务

Hosting Web Service in IIS - Not able to access the service

我在 Visual Studio 中有一个 WCF 服务应用程序项目,其中包含以下文件

我试图在 IIS 中托管 Web 服务,但是当我从 IIS 浏览到我的 Web 服务时,Web 服务根本没有加载。它只是在浏览器中显示 "loading"。

这是我的 WebConfig 文件:

 <?xml version="1.0"?>
    <configuration>
    <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
     </appSettings>
     <system.web>
    <compilation debug="false" targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.6.1"/>
     </system.web>
      <system.serviceModel>
    <services>
      <service behaviorConfiguration="Default" 
     name="WCFWebService.ZooWCFService">
        <endpoint address="" binding="basicHttpBinding" 
     contract="WCFWebService.IZooWCFService" />
        <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/" />
          </baseAddresses>
        </host>
        </service>
      </services>
       <behaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
         </serviceBehaviors>
       </behaviors>
     </system.serviceModel>
     </configuration>

我做了以下事情,我做错了什么?

  1. 打开 IIS
  2. 右键单击默认网站
  3. 已选择"Add Application"
  4. 已填充 "Alias" 字段
  5. 填充"Physical Path"到解决方案内容所在的目录
  6. 点击确定
  7. 在 Visual Studio
  8. 中重建解决方案

要在 IIS 中启用 WCF,您可能必须先启用 .net 框架的 HTTP 激活功能。

执行此操作的一些链接 https://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-326D6F7B-08EC-43EB-A5A7-9C51DD9E555C

https://pubs.vmware.com/mirage-56/index.jsp?topic=%2Fcom.vmware.mirage.api.pg.doc%2FGUID-552D845B-E530-4898-A06B-4F73E668BEFF.html

完成此操作后,您可以尝试将 WCF 直接从 visual studio 部署到本地 IIS>

右键单击 WCFproject -> 转到属性 -> 在属性 window -> select web 选项卡 -> 在服务器部分 select 本地 IIS,然后单击创建虚拟目录。

现在 运行 来自 Visual studio 的 WCF,这将在本地 IIS 中承载 WCF。

我们不需要在配置文件中指定基地址,需要在网站绑定模块中设置。
https://social.msdn.microsoft.com/Forums/vstudio/en-US/d42fc165-052d-476a-9580-1240b3d0293d/specify-endpoint-in-wcf-webconfig?forum=wcf
那么我们应该在 IIS 中启用 WCF 功能。
我们终于可以在 http://ip:port/xxxx.svc 中看到 Web 服务描述了。 如果有什么我可以帮忙的,请随时告诉我。