2016-09-06 5 views
0

VSを使用してクライアントプロキシを生成するときにIISでホストされるWCFサービスに接続できますが、ブラウザを見たときに、 ?WSDL。私は間違って何をしていますか?私はWCFサービスからWSDLを参照しようとしている空白ページを取得する

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ObjectServiceBehaviour"> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpEndpointBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <!-- This section is optional with the default configuration   model introduced in .NET Framework 4 --> 
     <service name="ObjectServiceApi.ObjectService" behaviorConfiguration="ObjectServiceBehaviour"> 

     <!-- This endpoint is exposed at the base address provided by host:http://localhost/ObjectService.svc --> 
     <endpoint address="" 
        binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpEndpointBinding" 
        contract="ObjectServiceApi.Interface.IObjectService" /> 

     </service> 
    </services> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
+0

あなたが呼んでいたURLとは何ですか?たぶんあなたは終わりのスラッシュを持っていますか?/'URL:http:// localhost:PORT/ObjectService.svc /' –

+0

http://10.220.175.59:8085/ObjectService.svc - 私は最後のスラッシュの有無にかかわらず試しました。エラーがスローされているかどうか確認するために、何らかの種類のIISトレースがありますか? – NZJames

+0

'security mode =" None "'と 'transport clientCredentialType =" None "'を設定しようとすることができます。おそらく、認証に問題があります。 –

答えて

0

がIISで、あなたのアプリケーションに認証方法が有効になっていることを確認していますWSDL

私のサービス・インターフェース

[ServiceContract] 
public interface IObjectService 
{ 
    [OperationContract] 
    [WebInvoke(
     Method = "POST", 
     RequestFormat = WebMessageFormat.Json, 
     ResponseFormat = WebMessageFormat.Json, 
     UriTemplate = "/GetTrade" 
     )] 
    GetTradeResponse GetTrade(GetTradeRequest request); 
} 

そして、私のweb.configファイルを参照する必要があります。

私はあなたがこれにあなたのweb.configを変更した場合、あなたのWSDLを呼び出すことができることはほぼ確信している(!):

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation targetFramework="4.5.2" /> 
    <httpRuntime targetFramework="4.5.2"/> 
    </system.web> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
     <binding> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows"/> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <protocolMapping> 
     <add scheme="http" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"/> 
    </protocolMapping>  
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 
+0

protocolMappingsブロックとwebserverブロックは何をしますか?確かに私はまだIISのエンドポイントを指定する必要がありますか、IISはそのサービスがどこにあるかをどのように知るのでしょうか? – NZJames

+0

'protocolMapping'はどのプロトコルがどのバインディングを使用しなければならないかを定義します。 'webServer'部分は実際には必要ありません(私の' web.config'からコピーしました)。 web.configでエンドポイントを指定する必要はありません。定義していない場合は、IISが自動的に処理します。 –

+0

''要素は 'basicHttpBinding'を使用している場合は必要ありません。これは' http'経由のWCFのデフォルトです。 – Tim

関連する問題