none
Unhandled fault exception occured on calling method ProjectSvcClient.CreateProjectFromTemplate() RRS feed

  • Question

  • Hi,

    Scenario - I am executing project loader service which need to create a project from exsiting template. We have enabled annonymous access on the site as par requirement. When I remove this annonymous access my code works fine but using annonymous access it gives error ""Unhandled Communication Fault occurred"

    Below is the peace of code

    string projectName = "Test PWA - 5";

    Guid _templateGuid = new Guid("0adfb7c5-9160-4d45-b485-3125f8306c34");

    Guid projectGuid = project.CreateProjectFromTemplate(_templateGuid, projectName);

    Coudl you please provide solution on this?

    Thanks & Regards

    Kailas


    Thursday, August 30, 2012 1:06 PM

All replies

  • Are you passing any credentials (such as DefaultCredentials) onto the webservice instance? With the instantiation of your service (the project instance in your case) you must provide this, as by default no credentials are submitted - which may explain why you require annonymous.

    Jan Cirpka

    Tuesday, September 4, 2012 6:48 AM
  • Hi Jan,

    Thanks for your reply.

    Your point is valid and I am sorry I forgot to mention that thing. Instance of 'Project' has provided credentials alreday. We have created class "PSICOre" in whcih objects are instantiated with the credentials.

    e.g. ProjectServerInfo psInfo = new ProjectServerInfo(pwaSite);
                        
          PsiCore project = psInfo.PSICore;

    string projectName = "Test PWA - 5";

    Guid _templateGuid = new Guid("0adfb7c5-9160-4d45-b485-3125f8306c34");

    Guid projectGuid = project.ProjectSvcClient.CreateProjectFromTemplate(_templateGuid, projectName);

     Also please see below code which gives idea about how it is instantiated in PSiCore class.

    PSICore.cs

    =============

    private SvcProject.ProjectClient _projectSvc = null;
            /// <summary>
            /// returns a WCF service client for PSI Project web service with all the httpbinding properties setup and ready to use.
            /// </summary>
            public SvcProject.ProjectClient ProjectSvcClient
            {
                get
                {
                    if (_projectSvc == null)
                    {
                        _projectSvc = new SvcProject.ProjectClient(_httpBinding, _svcAddress);
                        _projectSvc.ChannelFactory.Credentials.Windows.AllowedImpersonationLevel
                            = System.Security.Principal.TokenImpersonationLevel.Impersonation;
                        _projectSvc.ChannelFactory.Credentials.Windows.AllowNtlm = true;
                    }
                    return _projectSvc;
                }
            }

    Tuesday, September 4, 2012 8:34 AM