我想要使用WCF服務。我添加了一個服務引用,現在我試圖把它叫做:爲什麼app.config中缺少<system.serviceModel>部分?
BusStopServiceBinding.BusStopPortTypeClient client = new BusStopServiceBinding.BusStopPortTypeClient();
不過,我得到這個錯誤:
Could not find default endpoint element that references contract 'BusStopServiceBinding.BusStopPortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
我app.config
文件看起來像這樣:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
你可以看到
沒有serviceModel
部分。我應該手動添加它嗎?如果是這樣,我應該放入什麼?
一個很好的資源。請通過它(http://msdn.microsoft.com/en-us/library/ms731354.aspx) –