【问题标题】:error 400 Bad request, trying to add new WCF错误 400 错误请求,正在尝试添加新的 WCF
【发布时间】:2022-01-13 05:58:40
【问题描述】:

我正在尝试使用 asp.net 创建一个新项目。我必须将我们的 Web 服务(用 c# 制作)与我的新项目连接起来。我去“连接服务”->“右键单击”->管理连接的服务,然后我去添加 WCF Web 服务。在那里,我运行了 Web 服务所在的项目。然后,我添加了提供给我的网络浏览器的 URL,然后单击“开始”。

如您在我的屏幕截图中所见,每次都会出现错误 400。

enter image description here

在我的新项目中,我遇到了这个错误:

An error occurred while attempting to find services at 'http://localhost/Services/BlueLifeDataService.svc'. Cannot obtain Metadata from the URI: http://localhost/Services/BlueLifeDataService.svc 
 Check the URI and try again.If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.

当我想使用我的网络浏览器连接网络服务时,一切正常。我可以调用所有的查询。但不是这种情况。

你能帮帮我吗?

【问题讨论】:

标签: c# visual-studio web-services wcf


【解决方案1】:

您的服务 web.config 需要一个元数据端点 <serviceMetadata/>,也许您可​​以提供 web.config。

<behaviors>
    <serviceBehaviors>
        <behavior>
            <serviceMetadata/>
        </behavior>
    </serviceBehaviors>
</behaviors>

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-27
    • 2015-10-15
    • 2015-11-24
    相关资源
    最近更新 更多