簡體   English   中英

IIS CRM 2011 Web服務調用問題

[英]IIS CRM 2011 web service invocation issue

我有一個簡單的程序,一個asp.net網站,其中添加了一個Web服務。

一種網絡方法訪問了CRM`

 [WebMethod]
public bool RecordExists (String projectName)
{
    var service = GetService("http://localhost/EventoCorp/");

    Entity project = new Entity("new_project");

    /*PROJECT DETAILS*/
    project.Attributes["new_name"] = projectName;
    var request = new RetrieveDuplicatesRequest
    {
        BusinessEntity = project,
        MatchingEntityName = "new_project",
        PagingInfo = new PagingInfo() { PageNumber = 1, Count = 50 }
    };

    Console.WriteLine("Retrieving duplicates");
    var response = service.Execute(request);
    EntityCollection collection = (EntityCollection)response.Results["DuplicateCollection"];

    return collection.Entities.Count > 1 ? true : false;
}

當我按F5鍵時。 該項目運行良好。 我調用此record exist方法,並正確地從CRM 2011中獲取數據

但是,當我在IIS 7.5上部署此應用程序時。 我被這個極其無聊的例外所招呼

System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

服務器堆棧跟蹤:

 at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

我是CRM 2011新手。 不知道發生了什么。 請幫我

嘗試連接Web服務時使用的客戶端中會發生此異常。 它說只有未處理的異常發生在服務器端,但是沒有有關異常的信息。 另外,建議啟用IncludeExceptionDetailInFaults以便將未處理的異常詳細信息傳遞給客戶端。 但是,還有其他方法可以查看正在發生的情況,它附加在IIS進程上並調試Web服務。
另外,最好將異常處理添加到您的代碼中,因為現在代碼是完全不安全的。 當您訪問CRM時,可能會發生不同的異常,例如身份驗證異常等。此外,您只能獲取null而不是您想在那里的集合。
當您將此代碼部署到IIS時,可能會出現身份驗證問題,因為IIS在NETWORK SERVICE帳戶下運行。 而且,如果CRM使用Windows身份驗證,則您的請求很可能未被授權。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM