0

わかりました、これを約1週間検索してみましたが、うまくいきません...

「インデックスが配列の範囲外でした」というエラーが表示されましたデータまたはデータベース内のデータにアクセスしようとしています。これは私がやったことです:

アプリ構成:

    <basicHttpBinding>
    <binding name="BasicHttpBinding_ICoreService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

    <client>
  <endpoint address="http://localhost:4335/PortalService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICoreService"
    contract="WcfPortalReference.ICoreService" name="BasicHttpBinding_ICoreService" />

    <behaviors>
  <endpointBehaviors>
    <behavior name="portalBehaviour">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>

ウェブ構成:

    <basicHttpBinding>
    <binding name="basicHttp" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483646" maxArrayLength="2147483646"/>
    </binding>

    <services>
  <service name="TTM.FRX.WcfPortal.PortalService" behaviorConfiguration="portalBehaviour">
    <endpoint address="" bindingConfiguration="basicHttp" binding="basicHttpBinding" contract="TTM.FRX.WcfPortal.Contract.ICoreService" />

    <serviceBehaviors>
    <behavior name="portalBehaviour">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>

ここでエラーが発生します:

    TTMSystem.WcfPortalReference.CoreServiceClient cli = new TTMSystem.WcfPortalReference.CoreServiceClient();
        //pass custom credentials

        cli.ClientCredentials.UserName.UserName = typeof(AssemblyIdentifierAttribute).ToString().Split(new char[] { '.' })[typeof(AssemblyIdentifierAttribute).ToString().Split(new char[] { '.' }).Length - 1];
        cli.ClientCredentials.UserName.Password = ((AssemblyIdentifierAttribute)System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyIdentifierAttribute), false)[0]).Identifier;
        return cli;

clientCredentials に到達するとエラーが発生します(ユーザー名をステップオーバーしますが、パスワードはスキップします-ユーザー名は通過しません)誰でもこれで私を助けてくれますか? これに取り組むのはこれが初めてで、検索してみましたが、見つかりません... よろしくお願いします!!! もっと情報が必要です...

4

1 に答える 1

0

エラーは、存在しない配列内の要素にアクセスしていることです。

コードには次のものがあります。

Length -1 

行の1つの終わりに。

長さが0の場合、配列の要素-1にアクセスしようとします。これにより、エラーが発生します。

于 2013-02-06T17:14:36.093 に答える