2011-10-25 10 views
6

初心者からWCFページのデモビデオをMSDNにフォローしようとしています。「エンドポイントでサービスを設定する」デモが失敗する(Microsoft/endpoint.tv/Pluralsight)

最初のビデオは多かれ少なかれ細かく動作しました。私は今、2番目のビデオの終わりに向かっています。 VS20010/.NET 4.0を使用していますが、ビデオはVS2008を使用しているようです(.NET 3.5と仮定していますが、私は思い出しません)。プレーンHTTP、net.tcp、およびnet.pipe:

I'm using the following demo

は、私達はちょうど3つの複数のエンドポイントを追加しました。今すぐプロジェクトを実行しようとすると、Webサービスが開始されません。私のグーグルのfuに基づいて

System.InvalidOperationException: Cannot load the X.509 certificate identity specified in the configuration. 
    at System.ServiceModel.Description.ConfigLoader.LoadIdentity(IdentityElement element) 
    at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) 
    at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) 
    at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName) 
    at System.ServiceModel.ServiceHostBase.ApplyConfiguration() 
    at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) 
    at System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) 
    at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) 
    at Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind) 
    at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info) 

、私はこのスレッドに出くわした:"Cannot load the X.509 certificate identity specified in the configuration"

私が続くので、私はまだちょうど基礎を試していますので、私は本当にまだ証明書に巻き込ましたくありませんでしたその投稿のアドバイスを受けて、ちょうど<dns value="localhost" />タグを追加しました。例外の変更:8732するポートを変更しますが、例外はまだPlease try changing the HTTP port to 8732...HTTP could not register URL http://+:8732/EvalService/...を言って、この時間をスローされます。

Please try changing the HTTP port to 8732 or running as Administrator. 
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8080/EvalService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener) 
    at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) 
    at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.DatagramChannelDemuxer`2.OnOuterListenerOpen(ChannelDemuxerFilter filter, IChannelListener listener, TimeSpan timeout) 
    at System.ServiceModel.Channels.SingletonChannelListener`3.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.NegotiationTokenAuthenticator`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.CommunicationObjectSecurityTokenAuthenticator.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityUtils.OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityProtocolFactory.Open(String propertyName, Boolean requiredForForwardDirection, SecurityTokenAuthenticator authenticator, TimeSpan timeout) 
    at System.ServiceModel.Security.SymmetricSecurityProtocolFactory.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityProtocolFactory.Open(Boolean actAsInitiator, TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionSecurityTokenAuthenticator.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.CommunicationObjectSecurityTokenAuthenticator.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityUtils.OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionServerSettings.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionServerSettings.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open() 
    at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info) 
System.Net.HttpListenerException (0x80004005): Access is denied 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 

ので、私はそれを言ったことやってみました。 :P

私は無駄に新しいエンドポイントをコメントアウトしようとしました。このエラーでも元のものでも失敗します。

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="EvalServiceLibrary.EvalService"> 
     <clear /> 
     <endpoint address="ws" binding="wsHttpBinding" contract="EvalServiceLibrary.IEvalService" 
      listenUriMode="Explicit"> 
      <identity> 
      <dns value="localhost" /> 
      <certificateReference storeName="My" storeLocation="LocalMachine" 
       x509FindType="FindBySubjectDistinguishedName" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" 
      listenUriMode="Explicit"> 
      <identity> 
       <dns value="localhost" /> 
       <certificateReference storeName="My" storeLocation="LocalMachine" 
       x509FindType="FindBySubjectDistinguishedName" /> 
      </identity> 
     </endpoint> 
     <endpoint address="basic" binding="basicHttpBinding" contract="EvalServiceLibrary.IEvalService" 
      listenUriMode="Explicit"> 
      <identity> 
      <dns value="localhost" /> 
      <certificateReference storeName="My" storeLocation="LocalMachine" 
       x509FindType="FindBySubjectDistinguishedName" /> 
      </identity> 
     </endpoint> 
     <endpoint address="net.tcp://localhost:8888/EvalService" binding="netTcpBinding" 
      contract="EvalServiceLibrary.IEvalService" listenUriMode="Explicit"> 
      <identity> 
      <dns value="localhost" /> 
      <certificateReference storeName="My" storeLocation="LocalMachine" 
       x509FindType="FindBySubjectDistinguishedName" /> 
      </identity> 
     </endpoint> 
     <endpoint address="net.pipe://localhost/EvalService" binding="netNamedPipeBinding" 
      bindingConfiguration="" contract="EvalServiceLibrary.IEvalService" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8080/EvalService" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <serviceMetadata httpGetEnabled="True"/> 
      <serviceDebug includeExceptionDetailInFaults="False" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 

行う方法/間違っている何を:私は戻って元のポートにそれらを置けばここでApp.configファイルだし、何ものように問題を際立っていない[ない]のいずれか1337

問題ではありません私が直します?

答えて

3

上記の2つの問題(後者はHTTP could not register URL)の後者の一見して有効な解決策は、Gabobcatの答えのコメント(彼によって)に掲載されているVS2010 Training Kitにあります。

第4練習問題「Ex4-ServiceDiscovery」では、WCFサービスを使用して2つのクライアント間で通信するチャットアプリケーションのように見えます。それは発見機能を使用してネットワーク上の同輩を見つける。短い話ですが、完成したアプリケーションを最初に試してみると同じ例外が発生します(練習で示したディスカバリーイベントを記入してください)。トレーニングキットにはバッチスクリプト(AFAICTはMicrosoftの「オープンソース」ライセンスを使用しているので、これらのスクリプトを共有できるはずです)がバンドルされ、「URL ACL」を設定または削除します。

ファイル:AddURLACL.cmd

@Echo Off 
@Echo Grant permissions for URL reservation 
@Echo Parameter 1 "%1" == port 
@Echo Parameter 2 "%2" == URL 
pause 
netsh http add urlacl url=http://+:%1/%2 user=%USERDOMAIN%\%USERNAME% 

ファイル:実際には、彼らは唯一の(便利)コマンドのように見える明らかDelURLACL.cmd

@Echo Off 
@Echo Deletes permissions for URL reservation 
@Echo Parameter 1 "%1" == port 
@Echo Parameter 2 "%2" == URL 
pause 
netsh http delete urlacl url=http://+:%1/%2 

netshコマンドは、重要なものだけ。サンプルプロジェクトでは、(「管理者として実行」コマンドプロンプトウィンドウから)次のコマンドを使用し、この例外を「修正」しています

C:\VS2010TrainingKit\Labs\WhatsNewInWCF4\Source\Setup\AddURLACL.cmd 8000 

を(私はどこトレーニングキットでお見せするために、絶対パスを使用しましたあなたはこれらのスクリプトを見つけることができる、私はこれをした際に個人的に私はWhatsNewInWCF4 \ソースディレクトリであった)

を文字列8000のみがこのプロジェクト全体で1回発生します。

C:\VS2010TrainingKit\Labs\WhatsNewInWCF4\Source\Ex4-ServiceDiscovery\Begin\C#>findstr /n /s "8000" * 
DiscoveryChat\SimpleChat.cs:376:   this.localAddress = new Uri("http://localhost:8000/" + Guid.NewGuid().ToString()); 

をポート8000​​がポートであることが表示されますチャットクライアントが開始しようとしていることchサービスホスト(彼らがどのようにそれらを共有しているか私に尋ねないでください...彼らが使用するServiceHostクラスが既存のサービスを再利用するのに十分に知的であると仮定します...)。

私はこれをまだ十分に実験していませんが、私のEvalServiceプロジェクト(ポートを8000に変更したとき)が「固定」されているようです。これは現在、ほとんどのエンドポイントが削除されており(basicHttpBindingエンドポイントのみ残っています)、baseAddresslocalhost:8000に設定されています。

これがあなたにも役立つかどうか教えてください。

1

設定に問題があります。エンドポイント内の証明書を参照しています。いずれかを削除する:

<certificateReference storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectDistinguishedName" /> 

または、証明書ストアにいくつかの証明書を置きます。私はもう少しabour WCFを学ぶまで、この時点で "identity"設定セクションを削除することをお勧めします。初心者向けの基本的なエンドポイント構成に留まり、WCFの基本を理解している段階から作業を進めてください。 WCFは、特定のニーズに応じて、大規模な(大規模な)構成オプションセットを提供します。

たぶん、これらのリンクは、あなたがビデオは、あなたが見ていることをよりよくWCFに行くのに役立ちます。

は、この情報がお役に立てば幸いです。

+0

ありがとうございました。 ''タグをコメントアウトすると、X.509証明書のエラーが取り除かれますが、まだバインディングエラーが残っています。私は ''セクションもVisual Studioによって自動的に追加されたと思うので(私の特別な処置なしに)、このデモのためにそれらを取り除かなければならないのは直感的ではありません。 – bambams

+0

Enpoint/Bindingsはいくつありますか? basicHttpBindingを使用して1つのエンドポイントから開始します。参照している他のエンドポイントとバインディングを削除します。あなたはVS開発サーバーまたは他のWebサーバーを使用していますか?その場合、VSにポート番号を制御させます。他のWebサーバーを使用している場合は、デモ用にポート80を使用してください。必要な場合は、新しい例外を投稿してください。 –

+0

上記の最初のリンクはOPの最初のリンクです。 ;)それが私がビデオを見つけた場所です。 :P – bambams

7

私も同じwebcastに続き、同じ問題がありました。私は証明書の問題について、他の人が示唆しているようにそれらのエントリをコメントアウトすることで回避しました。

は、私は私のURLに戻す "Design_Time_Addresses" を追加することにより、 "8732にHTTPポートを変更したり、管理者として実行してみてください"

<add baseAddress="http://localhost:8732/AMessageService" /> 

ワークス動作しない修正しました!

<add baseAddress="http://localhost:8732/Design_Time_Addresses/AMessageService" /> 
+0

VS 2012でも私のために働きます。 –

1

私は同じ問題で挫折しました。最後に、Visual Studio 2010を右クリックし、[管理者として実行]を選択してVisual Studioを管理者として実行することで、自分自身で解決策を見つけました。

0

私が読んでいたものから更新された統合された回答を追加します。

我々は、すべての証明書を使用してアクセス権を許可するように偉大な長さに行くことができますが、これを読んで人々のほとんどは、実際にはWCFは、アップエンドポイントを取得したいとできるだけ早く実行されています。

このようにいくつかの選択肢。

1. sudipto-kumar-mukherjee above states "I was frustated with the same issue. 
Finally I found the solution by myself by running the Visual Studio as Administrator 
by right clicking Visual Studio 2010 and choosing 'Run As Administrator'." 
--> Yes, this  will work. 
OR 
2. nasp.tech response with 
"Doesn't Work" 
<add baseAddress="http://localhost:8732/AMessageService" /> 
"Works!" 
<add baseAddress="http://localhost:8732/Design_Time_Addresses/AMessageService" /> 

いずれも、この問題を解決する最も早い方法です。

-2

右のVisual Studioをクリックし、コンテキストメニューから[管理者として実行]を選択し、管理者として実行します。 は、コンテキストメニューの互換性]タブに ガットのプロパティに移動し、右のVisual Studioをクリックし、管理者としてのすべての時間を実行するには、[実行に管理者としてこのプログラムを選択します。

関連する問題