尝试使用Project Server SDK开发webpart。但是当我调用PSI方法时,无论采用哪种方法,都会出现异常。例如,当我运行以下代码时
using System;
using System.Web.UI;
using System.Web.Services.Protocols;
using System.Net;
namespace ProjectServerWebPart.PSWebPart
{
public partial class PSWebPartUserControl : UserControl
{
private ProjectWebSvc.Project project = new ProjectWebSvc.Project();
private ProjectWebSvc.ProjectDataSet projectList;
private string webApp = "http://portal/projeler/";
private string projectPath = "_vti_bin/PSI/Project.asmx";
private string username = "Administrator";
private string password = "***";
private string domain = "HES";
protected void Page_Load(object sender, EventArgs e)
{
project.Url = webApp + projectPath;
project.Credentials = new NetworkCredential(username, password, domain);
// This is where the exception is thrown
projectList = project.ReadProjectList();
}
}
}
在事件查看器的“应用程序”选项卡中,我们有
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 08.08.2012 11:19:37
Event time (UTC): 08.08.2012 08:19:37
Event ID: 5a53deb9f869489f985280392be91882
Event sequence: 39
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/8719922/ROOT-3-129888875537314012
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\wss\VirtualDirectories\80\
Machine name: PORTAL
Process information:
Process ID: 10360
Process name: w3wp.exe
Account name: HES\spadmin
Exception information:
Exception type: SoapException
Exception message: Unhandled Communication Fault occurred
Request information:
Request URL: http://portal/koseus/SitePages/Giriş Sayfası.aspx
Request path: /koseus/SitePages/Giriş Sayfası.aspx
User host address: fe80::642c:2aa1:4852:3359Full
User: HES\Administrator
Is authenticated: True
Authentication Type: NTLM
Thread account name: HES\spadmin
Thread information:
Thread ID: 10
Thread account name: HES\spadmin
Is impersonating: False
Stack trace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ProjectServerWebPart.ProjectWebSvc.Project.ReadProjectList()
at ProjectServerWebPart.PSWebPart.PSWebPartUserControl.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at ProjectServerWebPart.PSWebPart.PSWebPart.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
期待得到一些支持。提前谢谢。