C# 如何在WCF服务和客户端配置文件中禁用安全性

C# 如何在WCF服务和客户端配置文件中禁用安全性,c#,winforms,wcf,C#,Winforms,Wcf,我目前正在尝试将一些旧的.NET远程处理代码转换为WCF。我对这两种技术都不是很有经验,很难理解如何配置服务和客户端配置文件 我一直在使用WCF测试客户端和服务配置实用程序,我能够通过wsHttpBinding将客户端连接到服务。但是,这只在我的本地计算机上起作用,因为我还没有配置安全性。诚然,我目前不知道如何做到这一点 我想修改下面的配置文件,暂时禁用安全性以便于学习,直到我完全理解如何配置安全性。是否有人可以建议我需要做些什么来关闭下面服务和客户端配置文件中的安全性 服务配置文件: <

我目前正在尝试将一些旧的.NET远程处理代码转换为WCF。我对这两种技术都不是很有经验,很难理解如何配置服务和客户端配置文件

我一直在使用WCF测试客户端和服务配置实用程序,我能够通过
wsHttpBinding
将客户端连接到服务。但是,这只在我的本地计算机上起作用,因为我还没有配置安全性。诚然,我目前不知道如何做到这一点

我想修改下面的配置文件,暂时禁用安全性以便于学习,直到我完全理解如何配置安全性。是否有人可以建议我需要做些什么来关闭下面服务和客户端配置文件中的安全性

服务配置文件:

<system.serviceModel>
  <bindings />
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="FDServer.FuelServerService">
                <endpoint address="" binding="wsHttpBinding" bindingConfiguration=""
                    contract="FDServer.IFuelServerService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8732/Design_Time_Addresses/FDServer/FuelServerService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IFuelServerService" />
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8732/Design_Time_Addresses/FDServer/FuelServerService/"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFuelServerService"
          contract="IFuelServerService" name="WSHttpBinding_IFuelServerService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

客户端配置文件:

<system.serviceModel>
  <bindings />
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="FDServer.FuelServerService">
                <endpoint address="" binding="wsHttpBinding" bindingConfiguration=""
                    contract="FDServer.IFuelServerService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8732/Design_Time_Addresses/FDServer/FuelServerService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IFuelServerService" />
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8732/Design_Time_Addresses/FDServer/FuelServerService/"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFuelServerService"
          contract="IFuelServerService" name="WSHttpBinding_IFuelServerService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

此msdn线程有一些答案和示例: