2011-07-09 18 views
0

私のSilverlight 4.0アプリケーションから。私はWCFファイルに簡単にアクセスできますが、httpsに移動するとWCFサービスにアクセスできません。エラーの詳細は次のとおりです:https経由のSilverlight WCFアクセス時のエラー

An unknown error occurred. Please contact your system Administrator for more information. 

An exception occurred during the operation, making the result invalid. Check InnerException for exception details. 

    at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 
    at FileSearch.SearchServices.GetTypeofFileDetailedCompletedEventArgs.get_Result() 
    at FileSearch.Home.<SearchButton_Click>b__0(Object s, GetTypeofFileDetailedCompletedEventArgs ea) 
    at FileSearch.SearchServices.SearchServiceClient.OnGetTypeofFileDetailedCompleted(Object state) 

私はこの問題に関してさまざまな投稿を見ましたが、何も正しい方向に向いていません。

ここでは、SilverlightアプリケーションとWCFサービスをホストするWebアプリケーション用のweb.configファイルに関する詳細を示します。

<services> 
    <service name="FileSearch.Web.Services.SearchService"> 
    <endpoint address="" binding="customBinding" bindingConfiguration="FileSearch.Web.Services.SearchService.customBinding0" contract="FileSearch.Web.Services.SearchService" /> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 

、ここでservicerefernce.clientconfigファイルです:

<configuration> 
    <system.serviceModel> 
     <bindings> 
      <customBinding> 
       <binding name="CustomBinding_SearchService"> 
        <binaryMessageEncoding /> 
        <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> 
       </binding> 
      </customBinding> 
     </bindings> 
     <client> 
      <endpoint address="../Services/SearchService.svc" 
       binding="customBinding" bindingConfiguration="CustomBinding_SearchService" 
       contract="SearchServices.SearchService" name="CustomBinding_SearchService" /> 
     </client> 
    </system.serviceModel> 
</configuration> 

UPDATE:

私はHTTPSモードでサービスを実行するための答えを受けました。私は、httpとhttpsの両方のモードでサービスを実行したいと思います。

これに関するアイデアですか?

+0

サービスで呼び出す操作のコードを投稿できますか?その操作に例外があるように思えます。 – Tim

+0

しかし、httpでうまく動作しています。問題は 'https'であります –

+0

バインディングの設定ファイルにセキュリティ設定がありません - これは問題の一部である可能性がありますか? – Tim

答えて

2

を使用している参照<httpsTransport>.への輸送を変更する必要があると思います。

+0

それは正しいです。出来た。さらに、clientconfigファイル内に2つのエンドポイントと2つのバインディングを作成したサービス参照を更新し、その名前でバインディングに動的にアクセスする必要がありました。これは 'System.Windows.Browser.HtmlPage.Document.DocumentUri.Scheme.StartsWith ( "https") 'それはすべて...(これを見るために後で来る人のために) –

1

試みあなたの中に

<security mode="Transport" /> 

サービスの設定ファイルを追加します。これはバインディングノード内にネストされている必要があります。

thisのセキュリティモード設定のセクションをご覧ください。

+0

''をこれに追加することを意味しますか?セキュリティの下で直接的な 'mode'属性がないので... –

0

HTTPSスキームをサポートするために、あなたは私はあなたが2つのエンドポイントセキュリティで保護された輸送とそれがないものとのいずれかを指定します<httpTransport>.

+0

私はこれを試しましたが、うまくいきませんでした。私は 'binding = wsHttpBinding'でVinayの方法を試してみましたが、うまくいきましたが、httpsモードでしか動作しませんでした。私はそれがhttpとhttpsの両方のモードで動作したい... –

関連する問題