我正在研究WFC简单的helloWorld示例,我可以使用WCF测试客户端使用此服务,但是在为客户端应用程序创建代理类以使用此服务时出现错误
C:\My Work\My Development\WCFTestAPP\HelloWorldClient> http://localhost:63859/HostDevServer/HelloWorldService.svc?wsdl /out:HelloWorldServiceRef.cs /config:app.config
'http:' is not recognized as an internal or external command,
operable program or batch file.
[ServiceContract]
interface IHelloWorldService
{
[OperationContract]
string GetMessage(string name);
}
public class HelloWorldService : IHelloWorldService
{
public string GetMessage(string name)
{
return "Hello world from " + name + "!";
}
}
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment >
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/HostDevServer/HelloWorldService.svc" service="HelloWorldService.HelloWorldService"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
答案 0 :(得分:0)
您错过了要运行以生成代理的程序的名称 - svcutil。从开发人员命令提示符处,尝试
svcutil http://localhost:63859/HostDevServer/HelloWorldService.svc?wsdl /out:HelloWorldServiceRef.cs /config:app.config