开发者

Error when calling PSI web service: HTTP request is unauthorized with client authentication scheme 'Anonymous'

Could someone please help me? I am trying to create a project in project server programatically (PSI webservice) but am failing to do so because of the error below. Does anyone know what might be the issue? I am also getting this error when attempting to update the web service in VS2008.

Here is the error and it happens when I call QueueCreateProject (see code below):

System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestCh开发者_如何转开发annel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   --- End of inner exception stack trace ---

Here is the code:

       objProject = new pstest.ProjectWS.ProjectSoapClient();

           dsProjectDataSet = new pstest.ProjectWS.ProjectDataSet();
            ProjectWS.ProjectDataSet.ProjectRow projectRow = dsProjectDataSet.Project.NewProjectRow();
            Guid _projectGUID = Guid.NewGuid(); // new GUID for each project
            projectRow.PROJ_UID = _projectGUID;
            projectRow.PROJ_NAME = "My new Project";
            projectRow.PROJ_INFO_START_DATE = System.DateTime.Now;
            projectRow.PROJ_TYPE = 0; //0 is for project and 1 is for template
            dsProjectDataSet.Project.AddProjectRow(projectRow);

            //create a project using project.asmx

            objProject.QueueCreateProject(Guid.NewGuid(), dsProjectDataSet,false);


Most likely your app.config is misconfigured. Depending on your security configuration, you probably need to change part of it:

<security mode="TransportCredentialOnly">
  <transport clientCredentialType="Ntlm"/>
</security>

Take a look at this thread for more information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜