2016-06-30 10 views
0

:それが動作自宅WCFエラー:System.ServiceModel.AddressAccessDeniedException:私は次のデモWCFサービスプロジェクト(Windows 7のエンタープライズマシン)私が手を実行しようとすると

> Please try changing the HTTP port to 8733 or running as Administrator. 
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8080/helloworld/. 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`1.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.SymmetricSecurityProtocolFactory.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.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.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.SecuritySessionServerSettings.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.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 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() 

が、仕事でそれはそう私はいくつかの種類のペムスを上げる必要があるかもしれません。私はVSを管理者として実行し、ポートを8733に変更しようとしましたが、まだ問題があります。また、promoptコマンドで、 "netsh http urlacl url = http://+:8080/MyUri user = DOMAIN \ user"を追加しようとしましたが、 "url予約が失敗したエラー5を追加しました"と私は多分管理者がある種の許可を昇格させる必要があると考えています。ここで

はサービスである:ここでは

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Runtime.Serialization; 
using System.ServiceModel; 
using System.Text; 
using System.Threading.Tasks; 

namespace HelloWorldService 
{ 
    [DataContract] 
    public class Name 
    { 
     [DataMember] 
     public string First; 
     [DataMember] 
     public string Last; 
    } 

    [ServiceContract] 
    public interface IHelloWorld 
    { 
     [OperationContract] 
     string SayHello(Name person); 
    } 

    public class HelloWorldService : IHelloWorld 
    { 
     #region IHelloWorldMembers 
     public string SayHello(Name person) 
     { 
      return string.Format("Hello {0} {1}", 
       person.First, person.Last); 
     } 
     #endregion 
    } 
} 

はapp.configをである:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <appSettings> 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --> 
    <system.serviceModel> 
    <services> 
     <service name="HelloWorldService.HelloWorldService"> 
     <host> 
      <baseAddresses> 
      <add baseAddress = "http://localhost:8080/helloworld" /> 
      </baseAddresses> 
     </host> 
     <!-- Service Endpoints --> 
     <!-- Unless fully qualified, address is relative to base address supplied above --> 
     <endpoint address="ws" 
        binding="wsHttpBinding" 
        contract="HelloWorldService.IHelloWorld"/> 
     <endpoint address="basic" 
        binding="basicHttpBinding" 
        contract="HelloWorldService.IHelloWorld"/> 
     <endpoint address="net.tcp://localhost:8081/helloworld" 
         binding="netTcpBinding" 
         contract="HelloWorldService.IHelloWorld"/> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <!--<identity> 
      <dns value="localhost"/> 
      </identity>--> 

     <!-- Metadata Endpoints --> 
     <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
     <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, 
      set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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> 
    </system.serviceModel> 
</configuration> 
+0

[MCVE] –

+0

@cFrozenDeathを追加することから始めます。これは本当にシンプルなサービスですが、提供されています。 – MilesMorales

答えて

0

の代わりに:

netsh http add urlacl url=http://+:8080/MyUri user=DOMAIN\user 

試してみてください。

netsh http add urlacl url=http://+:8080/ user=DOMAIN\user 
他の点では

URI参照の最後の部分削除:すべてのヘルプみんなのために

https://msdn.microsoft.com/library/ms733768.aspx

0

感謝を。私のローカルマシン上では、VSまたはコマンドプロンプトを実行すると「管理者として実行」にオプションが与えられていますが、実際の管理者権限が必要でしたが、私は管理者権限を持っていませんでした。私は私の所でWindows Server Adminsに連絡して、私に自分のローカルの権利を与えてもらった。

「コンピュータの管理」、「ローカルユーザー」、および「グループ」に移動し、管理者にチェックマークを付け、LANが表示されているかどうかを確認することで、自分のユーザーの種類を確認できます。

関連する問題