1

我是 crm2011 的新手

我尝试创建一个插件,然后使用插件注册工具注册它

这是 Plugin.cs 文件的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Xrm;
using System.Runtime.Serialization;

namespace NewPlugin
{
public class Plugin : IPlugin
{
    /// <summary>
    /// A plugin that creates a follow-up task activity when a new account is created.
    /// </summary>
    /// <remarks>Register this plug-in on the Create message, account entity,
    /// and asynchronous mode.
    /// </remarks>
   public void Execute(IServiceProvider serviceProvider)
    {
        //Extract the tracing service for use in debugging sandboxed plug-ins.
        ITracingService tracingService =
            (ITracingService)serviceProvider.GetService(typeof(ITracingService));

        // Obtain the execution context from the service provider.
        IPluginExecutionContext context = (IPluginExecutionContext)
            serviceProvider.GetService(typeof(IPluginExecutionContext));

        // The InputParameters collection contains all the data passed in the message request.
        if (context.InputParameters.Contains("Target") &&
            context.InputParameters["Target"] is Entity)
        {
            // Obtain the target entity from the input parameters.
            Entity entity = (Entity)context.InputParameters["Target"];

            throw new InvalidPluginExecutionException("Plugin could not be registered");  
        }
    }        }
}
}

但是当我注册这个插件时,我得到了以下错误

Unhandled Exception: System.TimeoutException: The request channel timed out while   waiting for a reply after 00:01:59.4579323. Increase the timeout value passed to the call   to Request or increase the SendTimeout value on the Binding. The time allotted to this   operation may have been a portion of a longer timeout.

Server stack trace: 
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at    System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
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)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Create(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(Entity entity)
at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.RegisterAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly)
at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)
Inner Exception: System.TimeoutException: The HTTP request to 'https://demoorg172.api.crm.dynamics.com/XRMServices/2011/Organization.svc' has exceeded the allotted timeout of 00:01:59.9970000. The time allotted to this operation may have been a portion of a longer timeout.
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
Inner Exception: System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

如果你能解决这个问题,请帮助我。

4

2 回答 2

1

在这里,这将帮助任何为此苦苦挣扎的人:查看此网站:azure 预配置它已准备好进行编译,并且具有一键式方法并且已经在 azure 上。我的第二个猜测是正确的,您没有关闭所有适当的端口和防火墙并购买证书和域......所以只需检查一下并编译它真的很简单。我不喜欢 crm2011,但我现在比以前更了解它。我不知道我可以通过 iframe 做 ajax 和 javascript 以及几乎任何事情。干杯希望这会让事情变得更容易。

很好,所以您对 Iplugins 的 crm 和 cs 脚本还很陌生?SDK很棒,绰绰有余。你的线条看起来很紧,但我看到有几行需要稍微擦洗一下。我没有花太多时间在 crm 上,但我对它有一点了解,因为插件只是可执行的脚本,与 JavaScript、Ajax、python、html 非常相似。

当您使用参数//从服务提供者获取执行上下文时,它看起来就像我。

IPluginExecutionContext context = (IPluginExecutionContext)
        serviceProvider.GetService(typeof(IPluginExecutionContext));

    // The InputParameters collection contains all the data passed in the message request.
    if (context.InputParameters.Contains("Target") &&
        context.InputParameters["Target"] is Entity)
    {
        // Obtain the target entity from the input parameters.
        Entity entity = (Entity)context.InputParameters["Target"]; 


     ///Everything looks perfect up to that point but the service providers all have time 
     exceptions or if, they just don't like you pulling off of them if you don't have super   
     clean code. It will throw a fit and knock you off every time within probably a little over 
     a minute. When you are trying to pull the context params off you need to let it know what 
     you are doing with a so before this line of code you are going to need to put in a time 
     exception argument which allocates you time.
                                                                                                          ///I don't know what exactly your target is but it is a domain correct?
     If so you just need to throw an exception at it that will allow you                   
          to register and stay there all damn day if you please. 

    ///when it throws this "System.TimeoutException" it then proceeds to give you a miniscule 
  amount of time to respond because it is a script so it can execute however fast the ping is. 
     Right before you request anything use this exception    

                   //<serviceProvider.TimeoutException="Target"></client> 

       ///if it wants to keep being stubborn than continue to clean up your lines and use the 
             /></system argument whenever it throws a fit about time. reminds me a lot of old 
            school html and python. 


       /// If you are actually going one on one with the server you can throw a

                                                                                                                //<serviceProvider or 
           <domain.GetService.TimeoutException="reqast_info">*</client> 

        ///That should allow it to continue without losing any packets or throwing 
        any "time" exception

///Ipv6 协议工作得非常好。还打开域 tcp 和 udp 以及 sock 4 和 5 上的端口,然后最大量消耗端口 80 和 25 ......好吧,让我们说它是最宽容的端口,也是最容易去那里的。

        ///I hope I wasn't to late , but if I was than I am happy you got that "HelloWorld.cs" 
        Registered. Anyways man hope all is well. Sorry If I am not a huge help because I have,
        probably sounds and looks just like JavaScript.

///当我阅读处理程序异常时,我注意到有一部分在谈论“布尔值”这可能很重要,因为它确实可以将任何传入数据限制为每次都严重的士气低落的失败。就像一个完整的防火墙,除了没有例外。

“字符串操作,单向布尔值,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出” 布尔值用作数据包过滤器。而且它不是为进出流量设置的。所以它可以推送大量的数据包,但它只接收到足够的数据来完成它的工作。我记得代理服务器......学校里真正的代理服务器叫做 mcproserver 端口 8080,隧道而且非常激进。”而且代理服务器也会减慢它们抛出的更多流量。

在该域上做一些调查工作并获取他们的 ipv6 地址并通过终端运行一些网络挑战,这样你就可以确切地找出另一边的限制是什么,我会说它会清除日志并动态删除代理一个它们旋转数百个;每两个小时一次,如果您不是通过客户端通过隧道连接到它,那么它会在 2 秒内将您启动。他们的服务器本身可能每 7 天重置一次。这很可能是 A+AAAA 级和荒谬的。该布尔值还限制了代理服务器可以下行链接复杂数据包的带宽。

首先,您必须拥有一个安全的注册帐户,否则它永远不会去任何地方,其次是域:' https://demoorg172.api.crm.dynamics.com/XRMServices/2011/Organization.svc ' 甚至不存在一个域,所以这可能是您的全部问题,因为它无法建立两个小时的连接。不可能。你的台词非常简单。妈的比我好。我无法通过 ping 或 nslookup 访问该域的任何部分

所以在我看来,你必须首先通过我假设的客户端建立安全连接,或者如果你知道端口并且你有授权,那么你可以在服务器上运行一些测试,这样你就不能继续浪费你的时间只是为了发现它无法与它建立http连接。

你的插件与它无关。您没有与域建立正确的连接,因此可能会丢失 90% 的数据包,或者只是从一开始就将您关闭,但如果您使用终端启动网络共享或使用提升的权限发送和隧道然后将等待两个小时登录而不是使用网络浏览器或客户端。然后,如果您可以与域建立连接并且它不会丢弃数据包,并且如果它存在,那么您就是黄金。

但是要么你需要在你的一端打开几个端口并打开你的 nat 并设置防火墙例外,要么它就在那里。很可能是前者。您仍然可以尝试添加我为您准备的行,这确实会分配更多时间。但现在我更深入了。它把你的插件很好地煮熟了,然后在它完成所有它抛出一个 0 并关闭你之后向上同步,然后向下同步到最底部。我确定我只是在浪费时间打字,因为我才意识到它是在 3 个月前被问到的。希望这个时候你的能力已经超越了。

Ps 在我忘记之前,超时可能是一个非常小的缓冲区溢出,它会在您尝试注册时将您踢走。但我保证只有天文数字的机会,它会执行并绊倒你正在拉动目标的任何东西。如果它与 python 类似,那么您可以稍微更改我输入的行,使它们成为“div”扩展名,这只是一种更简单的方式,以我个人的经验:

 <div class="row-fluid">
    </div>
    <div class="row-fluid">
    <div class="span6">
    <label>
    <input type="text" name=name of the domain that you are using."
        <span class="inline_error_message error_"></span>
            </div>
        <div class="span6">
        <input type="text" name="" value= />
        <span class="inline_error_message error_">_</span>
        </div>
                    <div class="row-fluid">

          ///These are java script row-fluid 

///我怀疑这些会有帮助

于 2014-01-29T02:59:18.580 回答
0

这能解决吗?我正要试一试...

http://social.microsoft.com/Forums/en-US/8b408943-45cc-4104-b3f8-5f926312c7bc/crm-2011-plugin-registration-tool-timeout-error?forum=crmdevelopment

于 2013-10-29T14:24:00.097 回答