1

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.

1 Answers1

0

I have been able to call a WCF service within a Project Server Event Receiver DLL.

In order to do so, please follow these "tricks":

1.- For configuracion purposes, the DLL's (you code) execute within the Microsoft.Office.Project.Server.Eventing.exe process, which is located (in a default configuration) on: "C:\Program Files\Microsoft Office Servers\14.0\Bin". For custom installs open the task manager and right click the "Microsoft.Office.Project.Server.Eventing.exe" and select go to file. So, any configuration you need to be written in a file needs to be put in that directory insede the file: "Microsoft.Office.Project.Server.Eventing.exe.config". I have used this file to put a Database Connection String and I've been able to read it with the System.Configuration library. However, not all configuration sections works, I tried to put appSettings and a Sharepoint error was raised.

2.- For interaction with the Project Servers PSI, please use the WCF interface instead of the ASMX interface (I don't know why, but it works much better). I suggest using WCF programmatically (a quick search on google will net you how to set the bindings on the code).

I hope this helps you, I assure you it works. Now I'm trying to call ASMX service within the DLL (I'm still on it, if I find something I'll post).

Lucke
  • 221
  • 1
  • 4