WCF 默认端点丢失

发布于 2025-01-06 02:49:27 字数 2144 浏览 0 评论 0原文

我正在将 WCF 服务部署到 IIS 7,当我导航到服务 URL 时,我会看到如下页面:

Service Landing Page

我没有得到这样的典型登陆页面(从网上复制只是为了展示示例,数据经过模糊处理以保护无辜者):

在此处输入图像描述

有人可以告诉我我做错了什么吗?该服务按预期工作,但该服务的用户无法查看任何内容来了解​​方法是什么或从哪里获取 WSDL。

以下是我的相关文件:

App.Config(在服务项目中,并作为 IIS 的 Web.Config 复制到服务站点)

 <system.web>
    <compilation debug="true"/>
  </system.web>

  <system.serviceModel>
    <services>
      <service name="MyService.MyService" behaviorConfiguration="Web">
        <clear />

        <endpoint address=""
                  binding="wsHttpBinding"
                  name="ws"
                  behaviorConfiguration="Web"
                      contract="MyService.IMyService" />
<!--           
            <endpoint address="" 
                  behaviorConfiguration="Web" 
                  binding="webHttpBinding"
                  bindingConfiguration="" 
                  name="web" 
                  contract="MyService.IMyService" />
--> 

        <host>
          <baseAddresses>
            <add baseAddress="http://services.mydomain.com/MyService" />
          </baseAddresses>
        </host>

      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Web">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="Web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

MyService.svc

<%@ ServiceHost Service="MyService.MyService"
                Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

我还尝试使用“webHttpBinding”代替'wsHttpBinding' 似乎没有什么区别。

I am deploying a WCF Service to IIS 7 and when I navigate to the service URL I get a page like this:

Service Landing Page

I do not get the typical landing page like this (copied from the web just to show example, data blurred to protect the innocent):

enter image description here

Can someone tell me what I am doing wrong? The service works as expected but there is nothing for a user of this service to view to know what the methods are or where to get the WSDL.

Here are my relevant files:

App.Config (in service project and copied to service site as Web.Config for IIS)

 <system.web>
    <compilation debug="true"/>
  </system.web>

  <system.serviceModel>
    <services>
      <service name="MyService.MyService" behaviorConfiguration="Web">
        <clear />

        <endpoint address=""
                  binding="wsHttpBinding"
                  name="ws"
                  behaviorConfiguration="Web"
                      contract="MyService.IMyService" />
<!--           
            <endpoint address="" 
                  behaviorConfiguration="Web" 
                  binding="webHttpBinding"
                  bindingConfiguration="" 
                  name="web" 
                  contract="MyService.IMyService" />
--> 

        <host>
          <baseAddresses>
            <add baseAddress="http://services.mydomain.com/MyService" />
          </baseAddresses>
        </host>

      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Web">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="Web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

MyService.svc

<%@ ServiceHost Service="MyService.MyService"
                Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

I also tried using 'webHttpBinding' instead of 'wsHttpBinding' and it didn't seem to make a difference.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莳間冲淡了誓言ζ 2025-01-13 02:49:27

ServiceHost Service="MyService.MyService" ...这行正确吗?

ServiceHost Service="MyService.MyService" ... is this line correct?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文