Endpoint Services Configuration Demo Fails For Me (Microsoft / endpoint.tv / Pluralsight)

I am trying to follow along with demos on newbies on the WCF page on MSDN .

The first video worked more or less accurately. I am now at the end of the second video. I am using VS2010 / .NET 4.0, while the video seems to be using VS2008 (I assume .NET 3.5, but I don’t remember).

I am using the following demo

We added 3 more endpoints: simple http, net.tcp and net.pipe. When I try to start a project, the web service does not start.

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) 

Based on my Google fu, I came across this topic: "I can’t download the X.509 certificate id specified in the configuration"

I really didn’t want to enter certificates only since I was still just experimenting with the basics, so I followed the tips in this post and just added the <dns value="localhost" /> . The exception is changing:

 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() 

So, I tried to do what he said: changing the port to 8732, but an exception is still thrown, this time saying Please try changing the HTTP port to 8732...HTTP could not register URL http://+:8732/EvalService/... : P

I tried commenting on new endpoints to no avail. Even the original crash of this error. It doesn’t matter if I get them back to the original port [wrong] 1337.

Here's App.config, and nothing stands out as problematic:

 <?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> 

What is wrong / how to fix it?

+6
source share
6 answers

Apparently, a working solution for the last of the two above problems ( HTTP could not register URL one) can be found in the VS2010 Training Kit in Gabobkat's comments (from him).

In the fourth Ex4-ServiceDiscovery exercise, you are presented with what appears to be a chat application that uses WCF services to communicate between two clients. It uses the discovery feature to find peer-to-peer networks. In short, the same exception occurs when you first try to launch a completed application (after filling in the opening events, as indicated in the exercise). Included with the training kit are several batch scripts (in which AFAICT uses the Microsoft open source license so I can share these scripts) to set or remove the "ACL URLs". In practice, they seem to be the only (useful) command:

File: 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% 

File: 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 

Obviously, netsh commands are the only ones that matter. In the sample project, you use the following command (from the "Run as administrator" command window) to "fix" this exception:

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

(I used the absolute path only to show you where in the training kit you can find these scripts, I personally was in the WhatsNewInWCF4 \ Source directory when I did this)

Line 8000 occurs only once in this entire project:

 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()); 

Port 8000 seems to be the port on which chat clients try to start the service host (don't ask me how they all use it ... I assume that the ServiceHost class they use is smart enough to reuse an existing service .. .).

I have not experimented with this yet, but it seems to have “fixed” my EvalService project (when I changed the port to 8000). Currently, most endpoints have been removed (only the baseAddress endpoint remains) and baseAddress set to localhost:8000 .

Let me know if this works for you too.

+3
source

I also watched the same webcast and had the same problems. I circumvented the certificate issue by commenting on these entries as suggested by others.

I fixed "Please try changing the HTTP port to 8732 or start as administrator" by adding "Design_Time_Addresses" back to my URL

Does not work

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

Work!

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

The problem is in your configuration. You refer to certificates at your endpoints. Or you delete them:

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

Or you place certificates in your certificate store. I recommend deleting the "identity" configuration sections at this point until you know a little more than the WCF paragraph. Try to focus only on the basic configuration of endpoints for beginners and work your way from the place where you understand the basics of WCF. WCF provides you with a large (really large) set of configuration options depending on your specific needs.

Perhaps these links will help you better enter WCF so that the videos you watch are:

Hope this helps.

+1
source

I was scared of the same problem. Finally, I found the solution myself, starting Visual Studio as an administrator, right-clicking Visual Studio 2010 and choosing Run as Administrator.

+1
source

I think I would add an updated consolidated answer from what I read.

While we can do our best to allow access to the certificate, most people reading this just want to get WCF endpoints and work as soon as possible.

Thus, several options.

 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" /> 

Any of them, apparently, is the fastest way to get up and work with this problem.

0
source

To start as an administrator, right-click Visual Studio and select Run As Administrator from the context menu. To work as an administrator all the time, right-click Visual Studio, then go to the properties in the context menu. Go to the compatibility tab, then select Run this program as administrator.

-2
source

Source: https://habr.com/ru/post/900053/


All Articles