【发布时间】:2022-01-13 05:58:40
【问题描述】:
我正在尝试使用 asp.net 创建一个新项目。我必须将我们的 Web 服务(用 c# 制作)与我的新项目连接起来。我去“连接服务”->“右键单击”->管理连接的服务,然后我去添加 WCF Web 服务。在那里,我运行了 Web 服务所在的项目。然后,我添加了提供给我的网络浏览器的 URL,然后单击“开始”。
如您在我的屏幕截图中所见,每次都会出现错误 400。
在我的新项目中,我遇到了这个错误:
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.
当我想使用我的网络浏览器连接网络服务时,一切正常。我可以调用所有的查询。但不是这种情况。
你能帮帮我吗?
【问题讨论】:
-
能否请您edit 您对代码和异常详细信息的问题以文本 形式而不是屏幕截图形式?堆栈溢出图像不应用于问题中的文本内容,请参阅Discourage screenshots of code and/or errors 和Why not upload images of code on SO when asking a question 了解原因。有关格式化的说明,请参阅 How do I format my code blocks?。
-
事实上,如果您可以分享minimal reproducible example 向我们确切展示如何重现问题,那就太好了,并最大限度地提高这里有人可以帮助您的机会。请参阅:How to Ask。为了比较,请参阅 WCF - Error: Cannot obtain Metadata 以获取包含足够信息(特别是 web.config)以吸引正确答案的问题。
标签: c# visual-studio web-services wcf