我不確定爲什麼我遇到此問題,但我只能通過用戶控件或App.xaml與我的Web服務通信的.cs。我試圖在簡單的面向數據的類中使用該服務,所以我不想使用用戶控件。只能在Silverlight中通過用戶控件訪問Web Service名稱空間,而不是純C#classesm
這種精細編譯:
//App.xaml.cs
<using statements...>
namespace Sharepoint_Integration_Project
{
public partial class App : Application
{
private SharepointWS.SharepointWebServiceSoapClient SpWSSoap
= new SharepointWS.SharepointWebServiceSoapClient();
public App()
{
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
....
這不:凡提述SharepointWS.SharepointWebServiceSoapClient
//Controller.cs
<using statements copied from App.xml.cs...>
namespace Sharepoint_Integration_Project
{
private SharepointWS.SharepointWebServiceSoapClient SpWSSoap
= new SharepointWS.SharepointWebServiceSoapClient();
public class Controller
{
}
}
Visual Studio的報告 「預期類,委託,枚舉...」。
我使用這裏列出的相同步驟:
http://www.silverlightshow.net/items/Consuming-ASMX-Web-Services-with-Silverlight-2.aspx
我的Web服務的命名空間是Sharepoint_Integration_Project.SharepointWS我嘗試了完全限定它,這並沒有幫助。
任何建議表示讚賞,謝謝!
題外話 - 這是一個簡單的打字錯誤 - 並不會有助於未來SO用戶。 – arserbin3