如何在asp.net中使用wcf服务 [英] how to consume a wcf service in asp.net

查看:82
本文介绍了如何在asp.net中使用wcf服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个使用Visual Studio 2008创建的网站。我正在使用WCF服务从我的SQL Server 2008获取和检索一些信息当网站运行时,一切正常,当我在我的本地系统中的IIS中托管时,它出现了一个错误,例如,



无法建立连接,因为目标机器主动拒绝它127.0.0.1 visual studio



但是如果我尝试访问使用WCF服务的页面,我会收到有关连接被拒绝的错误。



有没有人给我任何解决方案?



谢谢和问候,

swathi

Hi,

I have a website that i have created using Visual Studio 2008. I am using WCF Service to fetch and retrieve some information from my SQL server 2008. Everything works fine when the website is running and When I hosted in IIS in My Local System,it got an error like,

no connection could be made because the target machine actively refused it 127.0.0.1 visual studio

However if i try and access my page that uses the WCF Services,i recieve the error about the connection being refused.

Has anyone give me any solution?

Thanks&Regards,
swathi

推荐答案





这是因为您在单个解决方案中有多个项目,并且您已添加其他项目中的Web服务引用(不在您的Web应用程序项目中)



只需复制Web服务引用的配置你的web应用程序的web.config文件的其他项目它应该工作。



问题发生是因为您的IIS严重在Web.config中寻找Web服务配置您的Web应用程序的文件


It happen because of you have multiple project inside single solution,and you have added web service reference in other project (not in your web application project)

just copy the web service reference's configuration from other project to your web application's web.config file It should work.

the problem is happen because your IIS severe is looking for web service configuration in your web.config file of your web application


看看这些:

MSDN:使用WCF服务 [ ^ ]

如何在Web应用程序中使用(或)使用wcf服务 [ ^ ]

在JavaSc中使用WCF服务的初学者指南ript使用ASP.NET AJAX [ ^ ]



不是最后一个但是:MSDN:Windows Communication Foundation初学者指南 [ ^ ]
Have a look at these:
MSDN: Consuming WCF Services[^]
how to consume (or) use wcf service in web application[^]
A beginner’s guide for consuming a WCF service in JavaScript using ASP.NET AJAX[^]

Not the last but: MSDN: Beginner's Guide to Windows Communication Foundation[^]


尝试

ASP.NET Web服务 [ ^ ]

您的第一个C#Web服务 [ ^ ]

http://www.w3schools.com/webservices/ws_example.asp [ ^ ]

http:// oreilly.com/catalog/prognetws/chapter/ch02.html [ ^ ]



您现在也可能想要考虑WCF。
Try
ASP.NET Web Service[^]
Your first C# Web Service[^]
http://www.w3schools.com/webservices/ws_example.asp[^]
http://oreilly.com/catalog/prognetws/chapter/ch02.html[^]

You also might want to consider WCF now.


这篇关于如何在asp.net中使用wcf服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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