Fejl ved webservice klient
Hej alleJeg bygger en klient til en offentlig webservice.
Jeg har en app.dll og en app.dll.config.
Når jeg tester klienten får jeg denne fejl:
Could not find endpoint element with name 'basicHttpEndpoint' and contract 'oes.dk.NavisionStatIntegrationService.INavisionStatIntegrationService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
Jeg har fornemmelsen af, at applikationen ikke læser den korrekte app.dll.config, der dannes når jeg bygger den.
Her er koden, der blev dannet da jeg kørte svcutil.exe:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.oes.dk/NavisionStatIntegrationService/2009/05/25", ConfigurationName = "oes.dk.NavisionStatIntegrationService.INavisionStatIntegrationService")]
public interface INavisionStatIntegrationService
{
[System.ServiceModel.OperationContractAttribute(Action = "http://www.oes.dk/NavisionStatIntegrationService/2009/05/25/INavisionStatIntegrat" +
"ionService/InvokeNavisionStatIntegration", ReplyAction = "http://www.oes.dk/NavisionStatIntegrationService/2009/05/25/INavisionStatIntegrat" +
"ionService/InvokeNavisionStatIntegrationResponse")]
string InvokeNavisionStatIntegration(string companyIdentifier, string immediateExecuting, string NSRequest);
}
Denne kode har jeg bygget til at kalde ovenstående:
proxy = new NavisionStatIntegrationServiceClient("basicHttpEndpoint");
proxy.ClientCredentials.UserName.UserName = this.UserName;
proxy.ClientCredentials.UserName.Password = this.Password;
this.NSResponse = proxy.InvokeNavisionStatIntegration(this.companyIdentifier, this.immediateExecuting, this.NSRequest);
return this.NSResponse;
Og her er client indholdet af app.dll.config:
<client>
<endpoint address="https://test3.oes.dk/NavisionStatIntegrationServiceTest/NavisionStatIntegrationService.svc"
binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding"
contract="oes.dk.NavisionStatIntegrationService.INavisionStatIntegrationService"
name="basicHttpEndpoint" />
</client>
Mvh. Søren