VS2005 프로젝트에서 WCF 클라이언트를 구현하려고합니다. VS2010에서는 서비스 참조를 추가 할 수 있기 때문에 정상적으로 작동합니다. VS2005의 경우 .config 및 Service1.cs를 svcutil로 빌드했습니다. 두 파일이 프로젝트에 추가되었고 서비스 참조가 웹 참조로 추가되었습니다. 생성 된 두 개의 파일을 찾을 수 있습니다.VS2005의 WCF 클라이언트
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SDTRfServerClass.WCFService.WSHttpBinding_IService1" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.102:8732/Design_Time_Addresses/Calc/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="SDTRfServerClass.WCFService.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
이것은 app.config이며 web.config로 변경하려고했지만 별 차이가 없습니다.
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IService1")]
public interface IService1
{
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/Add", ReplyAction = "http://tempuri.org/IService1/AddResponse")]
double Add(double n1, double n2);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/Substract", ReplyAction = "http://tempuri.org/IService1/SubstractResponse")]
double Substract(double n1, double n2);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/Multiply", ReplyAction = "http://tempuri.org/IService1/MultiplyResponse")]
double Multiply(double n1, double n2);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IService1/Divide", ReplyAction = "http://tempuri.org/IService1/DivideResponse")]
double Divide(double n1, double n2);
}
이것은 Service1.cs의 일부입니다. 다음 코드로 서비스를 호출하려고하면 "WSHttpBinding_IService1이라는 이름의 끝점 요소를 찾을 수없고 ServiceMode-client의 구성 부분에서 IService1과 계약합니다.이 경우 응용 프로그램의 구성이 다음과 같은 경우 발생할 수 있습니다. 하지를 찾을 수 없거나 이름을 맞춰야 엔드 포인트가 발견되었다. 나는 모든 장소에서 전체 솔루션의 이름으로 이름을 변경하려고했습니다. 이 솔루션으로 사람을합니까? 나는 또한에 시도
client = new Service1Client("WSHttpBinding_IService1");
double result = client.Add(Double.Parse("2"), Double.Parse("4"));
VS2005의 플러그 인을 사용하여 .map 및 .cs 파일을 만드는 서비스 참조를 추가하지만 동일한 오류가 계속 발생합니다.
어떤 NET의 버전을 사용하고 있습니까? –