WCF WSDL不显示XML,仅显示服务的URL! [英] WCF WSDL does not show XML, only the URL of the service!

查看:188
本文介绍了WCF WSDL不显示XML,仅显示服务的URL!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我一直在关注有关实现简单的WCF服务的文章,但遇到了障碍.我正在使用的文章是:

实施基本的Hello World WCF服务
http://www.codeproject.com/KB/WCF/HelloWorldWCF.aspx

我已经创建了WCF服务,并且可以在浏览器中看到该服务.问题是,当我单击该服务时
(在我的情况下:http://localhost:8080/HostDevServer/HelloWorldService.svc?wsdl)
我没有任何XML代码.

我得到以下信息:
http://localhost:8080/HostDevServer/HelloWorldService.svcMMorris-PC2 \ MMorris
(MMorris-PC2 \ MMorris是我的机器\用户名).

只是没有XML?!?!到目前为止,其他所有工作都已完成.

有什么想法吗?

我在Win7上运行VS2010.

非常感谢,
Michael

Hi Guys,

I''ve been following an article on Implimenting a simple WCF Service, but I''ve hit a roadblock. The article im using is:

Implementing a Basic Hello World WCF Service
http://www.codeproject.com/KB/WCF/HelloWorldWCF.aspx

I have created the WCF service, and can see the service in my browser. The problem is that when I click on the service
(in my case: http://localhost:8080/HostDevServer/HelloWorldService.svc?wsdl)
I do not get any XML code.

I just get the following:
http://localhost:8080/HostDevServer/HelloWorldService.svcMMorris-PC2\MMorris
(MMorris-PC2\MMorris is my machine\username).

There is just no XML?!?! Everything else has worked up until this point.

Any ideas?

I''m running VS2010 on Win7.

Many Thanks,
Michael

推荐答案

首先检查以确保您在WCF服务上启用了元数据发布.这是通过在web.config中添加一个元数据交换端点来完成的.
< endpoint contract ="IMetadataExchange" binding ="mexHttpBinding" address ="mex">

这是服务的一部分,描述WSDL中服务的功能.

其次,确保已使用ServiceContract和OperationContract属性装饰了界面.

[ServiceContract]
公共接口IHelloWorldService
{
[OperationContract]
字符串GetMessage(字符串名称);
}

希望这会有所帮助.
Hi, first check to make sure that you have meta data publishing enabled on the WCF Service. This is done by adding an meta data exchange endpoint in the web.config.

<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex">

This is the part of the service that describes the capabilities of the service in WSDL.

Second make sure that you have decorated the interface with the ServiceContract and OperationContract attributes.

[ServiceContract]
public interface IHelloWorldService
{
[OperationContract]
String GetMessage(String name);
}

Hopes this helps.


这篇关于WCF WSDL不显示XML,仅显示服务的URL!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆