我試圖創建一個應用程序,我可以通過Web服務將數據插入到數據庫中。我有一個很好的連接到我的ADO數據庫,但是當我嘗試從我的主要應用程序發送信息到我的Web服務時,出現以下錯誤。通過WCF Web服務將數據設置到ADO數據庫
找不到默認終結點元素,在ServiceModel客戶 配置部分引用合同 「MathServiceReference.IMathService」。這可能是因爲沒有爲您的應用程序找到配置文件 ,或者因爲沒有匹配 此協議可以在客戶端元素中找到的端點元素。
我的主要應用
protected void btnMultiply_Click(object sender, EventArgs e)
{
ServiceReference1.MathServiceClient client = new ServiceReference1.MathServiceClient();
txtSvar.Text = client.Multiply(int.Parse(txtTal2.Text)).ToString();
}
我在我的WWB服務類
public int Multiply(int box2)
{
if (box2 == null)
{
return 1;
}
else
{
koppling db = new koppling();
var testet = new tests();
testet.namn = box2.ToString();
db.tests1.AddObject(testet);
db.SaveChanges();
return 2;
}
}
我WCF配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
顯示你是WCF客戶端配置。 – abatishchev
我現在把它添加到我的問題 – TheZozoOwner