所以我之前的問題圍繞把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