繁体   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