我正在执行以下步骤。
使用 WCF 服务库创建 WCF 服务
通过在项目中按 F5 运行和测试 WCF 服务(它运行良好)
在 Visual Studio 的同一解决方案中创建另一个项目
- 将服务引用添加到我之前在步骤 1 中创建的 WCF 服务
但是,新项目无法识别我在步骤 1 中创建的 WCF 服务。如何使用在不同项目中创建的 WCF 服务?当从同一个项目调用相同的服务调用时,它可以正常工作。我在使用 HelloWorld2 时遇到了一条红线;
using HelloWorld2;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Helloworld2 client = new Helloworld2();
// Use the 'client' variable to call operations on the service.
// Name person = new Name();
// person.First = "Adam";
// person.Last = "Smith";
// Response.Write(person.First);
}
}
}