我试图创建一个应用程序,我可以通过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