I am creating a event handler in MS Project Server. This event handler is calling a class library (dll file). The event handler is set and triggered from within the MS Project by clicks and not by code. In this class library, I am having a service reference to a web service. But, whenever, the event is triggered, I see the following error when I debug the class library via 'Attach to Process' option:
Could not find default endpoint element that references contract 'PSS.Project.ProjectSoap' 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 contract could be found in the client element.
Here is what my app.config looks like:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="basicHttpBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpConf" sendTimeout="01:00:00" maxBufferSize="500000000"
maxReceivedMessageSize="500000000">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="500000000" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="ProjectSoap">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcProject.Project"
name="basicHttp_Project" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcResource.Resource"
name="basicHttp_Resource" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcStatusing.Statusing"
name="basicHttp_Statusing" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/Project.asmx?wsdl"
binding="basicHttpBinding" bindingConfiguration="ProjectSoap"
contract="PSS.Project.ProjectSoap" name="ProjectSoap" />
</client>
</system.serviceModel>
</configuration>
I also confirmed that the URL: http://xxxx/pwa/_vti_bin/PSI/Project.asmx?wsdl
is working.
In the cs file, the error appears on the following code:
ProjectSoapClient projectSvc = new ProjectSoapClient();
When I do the same thing in a console app, it works, but when use a class library, it fails. I have read some Q&A's here and I know that when I am calling a service reference from a class library, I need to include configuration files of the service reference into the the class library, but I am not quite sure how and where to bring the config files from in my case and what portion of app.config should I add it to.