2016-10-24 4 views
0

Autodesk Revitアドインの作成。 SOAP Webサービスと対話できるようにしますRevit Addin Visual Studio呼び出しSOAP Webサービス

アドインはクラスライブラリとして作成されます。 SOAPクライアントコードは、Visual Studio Service Referenceを使用し、wsdl urlを参照して生成されます。

私はRevitのからアドインを起動すると、私は次のエラーを取得する

のRevitは、System.InvalidOperationExceptionが発生しました:名前のエンドポイント要素を見つけることができませんでした「{XXX}を」とServiceModelクライアントで契約「{YYY}」構成セクション。

注1 Visual Studioプロジェクトをコマンドラインプロジェクトとして作成して直接実行すると、SOAP呼び出しが正常に機能することに注意してください。

注2 addinマニフェストで指しているビルドフォルダには.configファイルがあります。

<?xml version="1.0" encoding="utf-8" standalone="no"?> 
<RevitAddIns> 
    <AddIn Type="Command"> 
<Name>AIMRevitTestTwo</Name> 
<Assembly> 
    C:\Users\greg.bluntzer\Documents\Visual Studio 2015\Projects\AIMRevitTestTwo\AIMRevitTestTwo\bin\Debug\AIMRevitTestTwo.dll 
</Assembly> 
<AddInId>604b1052-f742-4951-8576-c261d1993109</AddInId> 
<FullClassName>App</FullClassName> 
<VendorId>xxx</VendorId> 
<VendorDescription>yyy</VendorDescription> 

私はそれが.configファイルを見ていきますように、私のVisual StudioプロジェクトまたはRevitのマニフェストに設定する必要が何か他のものがあります。

更新:私はこれを見つけましたlink revit.exe.configファイルの作成と更新を行い、それにバインディングを追加しようとしています。それは私の問題をローカルで解決します。私はこのアドインを配布したいので、私にとっては良い解決策ではありません。だから私はまだクラスライブラリに付属の設定ファイルを読むことができるようにaddinを作る方法を知りたいと思います。

SOLUTION:私は、コードに設定情報を構築する提案として

  <binding name="findAePReqEByDocumentSoapBinding" allowCookies="true"> 
       <security mode="TransportCredentialOnly"> 
       <transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="fmax" /> 
       <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 
      </binding> 

私の経験で最高の答えが持つのではなく、プログラムであなたのバインディングを作成することで、一般的に

BasicHttpBinding binding = new BasicHttpBinding(); 
     binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
     binding.AllowCookies = true; 
     binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
     binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; 
     binding.Security.Transport.Realm = "fmax"; 
     binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; 
     binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; 
     binding.MaxReceivedMessageSize = int.MaxValue; 
     binding.MaxBufferSize = int.MaxValue; 

     EndpointAddress endPointAddress = new EndpointAddress(DataAccess.END_POINT); 

答えて

1

に変身します設定ファイル

自動生成されたSOAPクライアントクラスのコンストラクタを見ると、(configから読み込んだ)おそらく使用している引数のないコンストラクタがありますが、アドレスを指定する別のものがありますコード内の拘束その道を行く。 BasicHttpBindingクラスのようなものをチェックしてください。 configで指定されたものはすべて、そのクラスのコードに追加できます。

+0

それはあなたに感謝しました –

関連する問題