1

mvc4 を使用して開発されたモバイル Web アプリにペイパル モバイル チェックアウトを統合しようとしていますが、関数 SetMobileExpressCheckout(xxx) を使用しようとすると、上記のエラーが発生します。

SDK の例の横に web.config エントリを追加し、SDK に付属する 2 つの dll への参照を追加しましたが、それでもクラッシュします。完全なエラー メッセージは次のとおりです。

{「ペイパルの構成セクション ハンドラーの作成中にエラーが発生しました: アセンブリ 'PayPal_Merchant_SDK' からタイプ 'PayPal.Manager.SDKConfigHandler' を読み込めませんでした。(C:\Projects\Mobile Development\Print Management\Print Management\web.config 行 8 )"}

これを見ると、以下に追加されているWeb構成ファイルのエントリを指しています。また、空のサイトで新しいプロジェクトを作成し、ページを追加し、すべてのweb.configエントリなどを作成しましたが、動作します大丈夫。

それはmvc4と関係があるのでしょうか??

web.config エントリが大きいことはわかっていますが、問題の原因が他にある場合に備えて、すべてをそこに入れると思いました。

私はこれを完成させることに非常に近いので、どんな助けも大歓迎ですが、ここで問題が何であるかを見つけることができないようです

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    <section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPal_Merchant_SDK"/>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Print Management-20130104084836;Integrated Security=SSPI"/>
  </connectionStrings>
  <paypal>
    <settings>
      <!-- The URL that the user must be redirected to in order to login and approve some payment actions-->
      <add name="paypalUrl" value="https://www.sandbox.paypal.com/webscr"/>
      <!-- The API endpoint -->
      <add name="endpoint" value="https://api-3t.sandbox.paypal.com/2.0"/>
      <!-- Connection timeout in milliseconds -->
      <add name="connectionTimeout" value="360000"/>
      <!-- The number of times a request must be retried if the API endpoint is   unresponsive -->
      <add name="requestRetries" value="3"/>
      <add name="binding" value="SOAP"/>
      <add name="IPAddress" value="127.0.0.1"/>
      <!-- 
      API version number. You will not normally have to change this unless you
      have a specific need to work with an older version of the API
     -->
      <add name="APIVersion" value="96.0"/>
    </settings>
    <accounts>
      <!--
      Add API credentials - 3 token or client certificate.
      You can add multiple account credentials here. The SDK will pick the first   account
      unless you specifically request an account in the service wrapper mehod.
    -->
      <account apiUsername="emailaddress" apiPassword="validpassword" apiSignature="signature" applicationId="APP-80W284485P519543T" certificateSubject="" signatureSubject=""/>
      <!--
    <account apiUsername="enduser_biz_api1.gmail.com" apiPassword="SACH3VA3C29DXGUG"
      apiCertificate="<Absolute path to paypal_cert.p12>" 
             privateKeyPassword="password" applicationId="APP-80W284485P519543T"/>
     -->
    </accounts>
  </paypal>
  <!-- Configure logging using the log4net library -->
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="MerchantLog.log"/>
      <appendToFile value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
      </layout>
    </appender>
    <root>
      <level value="DEBUG"/>
      <appender-ref ref="FileAppender"/>
    </root>
  </log4net>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="PreserveLoginUrl" value="true"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880"/>
    </authentication>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <namespaces>
        <add namespace="System.Web.Helpers"/>
        <add namespace="System.Web.Mvc"/>
        <add namespace="System.Web.Mvc.Ajax"/>
        <add namespace="System.Web.Mvc.Html"/>
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing"/>
        <add namespace="System.Web.WebPages"/>
      </namespaces>
    </pages>
    <profile defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>
    <roleManager defaultProvider="DefaultRoleProvider">
      <providers>
        <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
      </providers>
    </roleManager>
    <!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
      </providers>
    </sessionState>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
  </entityFramework>
</configuration>
4

3 に答える 3

1

Paypal のドキュメントとサンプルのアセンブリ名が間違っています。config セクションは、アセンブリ名を参照する必要があります。したがって、「PayPal_Core_SDK」は実際には「PayPalCoreSDK」である必要があります

于 2013-03-27T20:58:00.490 に答える
1

同じ問題があり、configSections 部分で PayPal_Merchant_SDK を PayPal_Core_SDK に交換することで解決できました。

于 2013-02-03T11:41:25.637 に答える
0

さて、昨日の夜遅くまで動作させようとした後、私は新しい mvc4 モバイル Web アプリを作成することに決め、paypal の参照などだけを入れました。他のアプリを使用していますが、コードをセクションごとに転送する方がおそらく速いと思います。

人に知らせようと思っただけです。機会があれば、もう一度コードを見てみましょう。

于 2013-01-29T09:38:26.533 に答える