在 Web 中使用服务参考 api
Consuming service reference in web api
1)我正在 VS2013 中创建一个 ASP.NET Web 应用程序-> 空(选择 Web Api)项目并添加服务引用 (wsdl)
public class BJKController : ApiController
{
[HttpGet]
public byte[] GetArchive(string workOrderNo)
{
BjkClient client =new BjkClient();
return client.GetInvoice(workorderNo);//I'm getting error this line
}
}
web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ICompany" maxReceivedMessageSize="64000000">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://service.karakartal.com.tr/Company.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICompany"
contract="ServiceReference1.ICompany" name="WSHttpBinding_ICompany" />
</client>
</system.serviceModel>
我正在调试并在 webapi 项目中遇到错误:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机未能响应X.X.XXX.XXX:443
但我正在尝试一个 windows 项目(也添加服务引用)
一切都一样(网络配置和使用)。它工作正常。
当我转移到 IIS 时它运行良好。
1)我正在 VS2013 中创建一个 ASP.NET Web 应用程序-> 空(选择 Web Api)项目并添加服务引用 (wsdl)
public class BJKController : ApiController
{
[HttpGet]
public byte[] GetArchive(string workOrderNo)
{
BjkClient client =new BjkClient();
return client.GetInvoice(workorderNo);//I'm getting error this line
}
}
web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ICompany" maxReceivedMessageSize="64000000">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://service.karakartal.com.tr/Company.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICompany"
contract="ServiceReference1.ICompany" name="WSHttpBinding_ICompany" />
</client>
</system.serviceModel>
我正在调试并在 webapi 项目中遇到错误:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机未能响应X.X.XXX.XXX:443
但我正在尝试一个 windows 项目(也添加服务引用) 一切都一样(网络配置和使用)。它工作正常。
当我转移到 IIS 时它运行良好。