简体   繁体   English

IIS CRM 2011 Web服务调用问题

[英]IIS CRM 2011 web service invocation issue

I had a simple program , a asp.net website in which i added a webservice 我有一个简单的程序,一个asp.net网站,其中添加了一个Web服务。

One of the web methods accessed a CRM ` 一种网络方法访问了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;
}

When I press F5. 当我按F5键时。 the project runs fine . 该项目运行良好。 I invoke this record exists method , and it correctly brings data from the CRM 2011 我调用此record exist方法,并正确地从CRM 2011中获取数据

However when i deploy this application on IIS 7.5 . 但是,当我在IIS 7.5上部署此应用程序时。 I get greeted by this terribly uninformative exception 我被这个极其无聊的例外所招呼

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.

Server stack trace: 服务器堆栈跟踪:

 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)

I am a CRM 2011 noob . 我是CRM 2011新手。 No idea what is going on . 不知道发生了什么。 Please help me 请帮我

This exception happens in the client you use when trying to connect your web service. 尝试连接Web服务时使用的客户端中会发生此异常。 It says only that unhandled exception happened on server side, but has no information about exception. 它说只有未处理的异常发生在服务器端,但是没有有关异常的信息。 Also there is advice to enable IncludeExceptionDetailInFaults in order to pass to the client unhandled exception details. 另外,建议启用IncludeExceptionDetailInFaults以便将未处理的异常详细信息传递给客户端。 But there is also other way to see what is going on, it's attach to IIS process and debug your web service. 但是,还有其他方法可以查看正在发生的情况,它附加在IIS进程上并调试Web服务。
Also it would be better add exception handling to your code, because now code is completely unsafe. 另外,最好将异常处理添加到您的代码中,因为现在代码是完全不安全的。 Different exceptions can happen when you are accessing CRM, like authentication exception etc. Also you can just get null instead of collection you suppose to be there. 当您访问CRM时,可能会发生不同的异常,例如身份验证异常等。此外,您只能获取null而不是您想在那里的集合。
When you deploying this code to IIS authentication issues are possible, since IIS is working under NETWORK SERVICE account. 当您将此代码部署到IIS时,可能会出现身份验证问题,因为IIS在NETWORK SERVICE帐户下运行。 And in case if CRM uses Windows Authentication it's possible your request will not be authorized. 而且,如果CRM使用Windows身份验证,则您的请求很可能未被授权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 扩展 Dynamics CRM 2011 服务 - Extending Dynamics CRM 2011 Service 奇怪的IIS / WCF Web服务问题 - Strange IIS/WCF Web Service Issue 如何通过在.Net库项目中添加为Web参考来尝试调用CRM 2011服务时解决“操作超时”问题? - How to fix “The operation time out” when trying to call CRM 2011 Service by adding as web reference in .Net library project? 从Dynamics CRM 2011插件调用WCF服务 - Calling WCF service from dynamics crm 2011 plugin WCF服务到CRM 2011中的IFD / ADFS连接错误 - IFD/ADFS connection errors in WCF service to CRM 2011 负载平衡MS Dynamics CRM 2011沙盒处理服务 - Load Balancing MS Dynamics CRM 2011 Sandbox Processing Service 如何使用C#/ VB.Net和WCF部署服务或CRM 2011 SDK启用和禁用CRM 2011组织? - How to enable and disable a CRM 2011 Organization using C#/VB.Net and WCF Deployment Service or CRM 2011 SDK? 呼叫者未通过服务错误进行身份验证-CRM 2011部署通过SSL调用wcf服务方法吗? - Caller was not authenticated by the service error - CRM 2011 Deployment wcf service method call over SSL? 无法将CRM 2011的组织服务添加为VS项目的服务参考 - Unable to add CRM 2011's Organization service as Service Reference to VS project IIS托管WCF服务使用另一个Web服务时出现“没有端点侦听”问题 - “There was no endpoint listening at” issue with a IIS Hosted WCF Service consuming another web service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM