所以我之前的问题围绕把wcf变成宁静的服务convert a WCF Service, to a RESTful application?,我设法做一些帮助!没有端点监听wcf/rest
但我遇到了我的客户一个新的问题:
There was no endpoint listening at http://localhost:26535/Service1.svc that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
现在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));
}
}
}
我看着前面的问题在SO上的这个区域:WCF - "There was no endpoint listening at..." error
但是它没有提供解决方案吗?我不熟悉在IIS上托管或不是这只是练习,所以让它在调试(F5)上工作会更好!
你的内部异常是什么?这可能会对此有更多的了解。 – 2012-03-24 20:40:08
做一个内部异常只是说远程服务器返回一个错误:(404)未找到。 – 2012-03-24 20:56:33