0

I am developing a custom SharePoint Application page. This page has a button which calls a web service. I managed to get it to run just fine, and was also able to deploy it successfully.

However, in PROD environment, calling the web service on button click is displaying the following exception message:

Could not find endpoint element with name 'NetTcpBinding_LSCCertificateService' and contract 'AXWebService.LSCCertificateService' 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.

I have modified the C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config file by adding the following lines to the very end of the document, just before the last closing </configuration> tag:

  ...
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_LSCCertificateService" />
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://OSMDEVAOS01:8201/DynamicsAx/Services/LSCTCTSGroup"
      binding="netTcpBinding" bindingConfiguration="NetTcpBinding_LSCCertificateService" contract="AXWebServices.LSCCertificateService" name="NetTcpBinding_LSCCertificateService">
        <identity>
          <userPrincipalName value="[email protected]" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

The button's event handler method calling the web service is:

{ 
  ...
  Item document = new Item();
  document.ActionType = LSCActionType.Insert;
  document.CertificateType = itemID;
  document.PersonnelNumber = personID;

  LSCCertificateServiceClient client = 
      new LSCCertificateServiceClient("NetTcpBinding_LSCCertificateService");
  client.saveChanges(new CallContext(), document);
}

And another thing; I have developed a SharePoint Timer Job Definition which calls that exact same method from above. Its OWSTIMER.exe.config file contains the same configuration mentioned above as does the web.config. The job runs with no issues. This leads me to the conclusion that the configuration itself is correct. But why is the button event handler firing error and not being able to read the web.config?

1 Answer 1

0

The web.config for application pages is located in the {SharePointRoot} folder.

However, I recommended that you move your service to the ISAPI folder (mapped to _vti_bin) or to a separate IIS website.

1
  • The service is an AOS web service deployed in Microsoft Dynamics AX. All I have in my solution is a Service Reference. I do not have the actual code of the web service.
    – Boris
    Commented Apr 18, 2014 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.