2011-04-27 92 views
0

我開發應用OrganizationServiceProxy和OrganizationServiceContext查詢CRM Web服務 在我的本地主機它西港島線是好的,但是當我部署在服務器上的網站,我有一個例外,一個aspx網站查詢CRM web服務從網站

ClientCredentials credentials = new ClientCredentials(); 
credentials.Windows.ClientCredential = (NetworkCredential)System.Net.CredentialCache.DefaultCredentials; 
OrganizationServiceProxy _service = new OrganizationServiceProxy(new Uri("http://../XRMServices/2011/Organization.svc"), null, credentials, null); 

OrganizationServiceContext _context = new OrganizationServiceContext(_service); 

WhoAmIRequest userRequest = new WhoAmIRequest(); 

WhoAmIResponse userResponse = (WhoAmIResponse)_service.Execute(userRequest); 
+2

你的問題不清楚。你會得到什麼例外,你什麼時候得到它? – TeaDrivenDev 2011-04-27 16:36:49

+0

您可以使用連接字符串 - 將其存儲在Web.config文件中.... http://msdn.microsoft.com/en-us/library/gg695810.aspx – 2014-01-14 00:38:53

回答

0

我有點問同樣的問題here。顯然,Windows憑據不是OrganizationServiceProxy期望的。