2012-05-14 4 views
1

UPDATE:これは誰もがこの問題を診断するのに役立ちますが、WSDLのようにエンドポイントを持っている場合、私は知らない。は、Visual Studioによって公開されているWCFのWebサービスをヒットすることはできません

http://localhost:8523/Temp/WebService.svc/WebService.svc 

どの間違って、私は最後に余分なビットを削除するためにエンドポイントを変更し、手動で試してみた、それはまだWH、404

/更新

私はWCFを使用してWebサービスに取り組んでいるが返されますja VS2010デバッガを実行しました。次のエラーメッセージが表示されます。

対象アセンブリにサービスタイプが含まれていません。このアセンブリのコードアクセスセキュリティポリシーを調整する必要があります。

これまでのソリューションでは、[ServiceContract]をインターフェイスに追加する必要がありますが、既にそこにあると言います。

私は、csprojファイルからタグを削除しなければならないと言う人もいますが、これによってプロジェクトはWebサービスではなくクラスライブラリになります。

しかし、私のブラウザは、ディレクトリのリストに開き、私は.SVCファイルをクリックして、.SVCするためのリンクをクリックすることで、コンテナによって生成されたWSDLにナビゲートすることができますか?WSDL

私が試してみて、ヒットした場合私は404で例外を取得するアプリケーションから、またはWCFサービスのテスターからのサービスは、私が一緒にテストアプリをcbbled、ここでそれは私を与える例外である:ここでは

Sending Message: Make Call: InteractionId [rt], Destination [ert], ExternalReferenceId [ert], userIdentifier [ert] attachedData [rt] 
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8523/WebService.svc?wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found. 
    at System.Net.HttpWebRequest.GetResponse() 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    --- End of inner exception stack trace --- 

Server stack trace: 
    at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout) 
    at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) 
    at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at Sabio.Avaya.AACC.ProxyServiceLibary.IProxyService.MakeCall(MakeCallRequestData MakeCallRequestData) 
    at Sabio.Avaya.AACC.ProxyServiceLibary.WSPipeProxyClient.MakeCall(MakeCallRequestData MakeCallRequestData) in C:\Users\me\Documents\Visual Studio 2010\Projects\WebService\RemoteClientLib\WSPipeProxyClient.cs:line 42 
    at ClientLibTestUI.WcfTestApp.MPCWSButton_Click(Object sender, EventArgs e) in C:\Users\me\Documents\Visual Studio 2010\Projects\WebService\ClientLibTestUI\Form1.cs:line 97 

は私のWeb.configファイルである:

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="WebService" behaviorConfiguration="WebServiceBehaviour"> 
     <endpoint address="WebService.svc" 
        binding="wsHttpBinding" 
        bindingConfiguration="DefaultWSBinding" 
        name="WSEndPoint" 
        contract="IWebService"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" 
        bindingConfiguration="mexHttpBinding"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost/Temp/"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <bindings> 
     <netTcpBinding> 
     <binding name="DefaultNetTcpBindingConfig" 
       maxConnections="5" 
       portSharingEnabled="true" > 
      <security mode="None"/> 
     </binding> 

     </netTcpBinding> 
     <wsHttpBinding> 
     <binding name="DefaultWSBinding"> 
      <security mode="None"/> 
     </binding> 
     </wsHttpBinding> 

     <mexHttpBinding> 
     <binding name="mexHttpBinding"/> 
     </mexHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ServerServiceBehaviour"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
     </behavior> 
     <behavior name="MexBehaviour"> 
      <serviceMetadata httpGetEnabled="true" policyVersion="Policy15"/> 

     </behavior> 
     <behavior name="WebServiceBehaviour"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

誰かが私が間違っていることを教えてもらえますか? VS2010のIISまたは組み込みのWebサーバーでホストしても同様の問題が発生します

答えて

0

設定のサービスタグが間違っています。

<service name="namespace.WebService" behaviorConfiguration="WebServiceBehaviour"> 
     <endpoint address="WebService.svc" 
        binding="wsHttpBinding" 
        bindingConfiguration="DefaultWSBinding" 
        name="WSEndPoint" 
        contract="namespace.IWebService"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" 
        bindingConfiguration="mexHttpBinding"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost/Temp/"/> 
      </baseAddresses> 
     </host> 
     </service> 

サービス要素の名前の値とエンドポイント要素の契約値は完全修飾されている必要があります。

+0

Web.configのクライアントへの参照を削除すると、サービス名とエンドポイントコントラクトの両方がネームスペースになります。ごめんなさい。 –

+0

あなたはIIS上でホスティングしていますか?プロジェクトに.svcファイルがありますか。 config内のサービス名とエンドポイント契約が完全修飾名として指定されていることを意味しますか? – Rajesh

+0

IISとCassini(Visual Studio)でホスティングを試しました。[ServiceContract]を実装する.svcファイルがありますクリーンなソリューションでコードをリロードし、そのコードが正常に動作するかどうかを確認してください。 –

関連する問題