【发布时间】:2014-03-18 10:13:34
【问题描述】:
Dynamic GP 2013 安装程序已在服务器 (Windows Server 2008 R2) 上成功完成。在 SQL Server 2008 R2 上自动创建的数据库。服务已创建并且正在运行。
在 Visual Studio 2012 上开发一个控制台应用程序,并添加了 Dynamic GP 的 Web 服务。 http://MyDomainName:48620/Dynamics/GPService/mex
使用下面给出的示例代码进行测试:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebServiceConsoleApp.DynamicGPAtTen;
using System.ServiceModel;
namespace WebServiceConsoleApp
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
Vendor vendor;
VendorKey vendorKey;
Policy vendorPolicy;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context object with which to call the web service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context
context.OrganizationKey = companyKey;
// Create a new vendor key
vendorKey = new VendorKey();
vendorKey.Id = "TstVndr0001";
// Populate the vendor object
vendor = new Vendor();
vendor.Key = vendorKey;
vendor.Name = "TestVendor0001";
// Get the create policy for the vendor
vendorPolicy = wsDynamicsGP.GetPolicyByOperation("CreateVendor", context);
// Create the vendor
wsDynamicsGP.CreateVendor(vendor, context, vendorPolicy);
// Close the service
if (wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}
运行应用程序后,它会给出以下错误消息:
There was no endpoint listening at http://MyDomainName:48620/Dynamics/GPService/GPService that could accept the message. This is often caused by an incorrect address or SOAP action.
有什么解决办法吗?
图片的详细信息
【问题讨论】:
标签: c# web-services