我试图在
MSDN上跟随初学者的演示视频到WCF页面.
第一个视频或多或少都很好.我现在正走向第二个视频的结尾.我正在使用VS2010 / .NET 4.0,而视频似乎使用的是VS2008(我假设是.NET 3.5,但我不记得).
我们刚刚添加了3个端点:一个普通的http,net.tcp和net.pipe.当我现在尝试运行项目时,Web服务无法启动.
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,ServiceElement serviceSection) at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader,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)
基于我的Google fu,我遇到了这个帖子:“Cannot load the X.509 certificate identity specified in the configuration”
我真的不想参与证书,因为我还在尝试基础知识,所以我按照该帖子中的建议添加了< dns value =“localhost”/>标签.异常更改:
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.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()
所以,我试着说它说:将端口更改为8732,但仍然抛出异常,这次说请尝试将HTTP端口更改为8732 … HTTP无法注册URL http://:8732 / EvalService / ….:P
我试过评论新的终点无济于事.即使是原始的也会因此错误而失败.如果我把它们放回原来的端口[不是那么] 1337也没关系.
这是App.config,并没有什么突出的问题:
<?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>
有什么问题/我该如何解决?