【发布时间】:2012-03-24 20:07:28
【问题描述】:
所以我之前的问题围绕着将 wcf 变成一个宁静的服务convert a WCF Service, to a RESTful application?,我设法在一些帮助下做到了!
但是我遇到了客户的一个新问题:
在http://localhost:26535/Service1.svc 上没有可以接受消息的端点侦听。
这通常是由不正确的地址或 SOAP 操作引起的。看 InnerException(如果存在),了解更多详细信息。
现在,从屏幕转储中可以看出,restful 服务正在运行:
我可以像这样从 url 添加值 1:
但我似乎无法在另一个新的 Visual Studio 实例上运行它,我的客户端 app.config 如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WebHttpBinding_IService1">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport></httpTransport>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:26535/Service1.svc" binding="customBinding" bindingConfiguration="WebHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WebHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
客户端代码:
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public ServiceReference1.Service1Client testClient = new ServiceReference1.Service1Client();
private void button1_Click(object sender, EventArgs e)
{
label1.Text = testClient.GetData(Convert.ToInt32(textBox1.Text));
}
}
}
我在这里查看了该领域以前的问题:WCF - "There was no endpoint listening at..." error
但它没有提供任何解决方案?我不熟悉在 IIS 上托管,或者这只是练习,所以让它在调试(F5)上工作会很好!
【问题讨论】:
-
你内心的异常是什么?这可能会更清楚地说明这一点。
-
做一个内部异常只是说远程服务器返回了一个错误:(404)未找到。
标签: c# wcf visual-studio-2010 rest