没有端点侦听URL可以接受该消息?

时间:2015-07-30 17:45:26

标签: wcf

我在IIS上遇到了这个问题,但是当我在我的机器上运行它时它运行正常。请参阅下面的web.config。我被困在这种情况很长一段时间请帮助我解决问题。

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

    <configuration>
    <system.web>
    <compilation targetFramework="4.5.1" tempDirectory="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\five9" />
    <customErrors mode="Off"/>
    <httpRuntime targetFramework="4.5.1" />
    </system.web>
    <system.serviceModel>
        <bindings>`enter code here`
            <basicHttpBinding>
                <binding name="WsAdminBinding" maxReceivedMessageSize="2147483647">
                    <security mode="Transport">
                        <transport clientCredentialType="Basic" />
                    </security>

                    <!-- <security mode="TransportWithMessageCredential">
                        <transport clientCredentialType="UserName" />
                    </security> -->
                </binding>
                <binding name="WsAdminBinding1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://api.five9.com/wsadmin/v3/AdminWebService" binding="basicHttpBinding" bindingConfiguration="WsAdminBinding" contract="Five9API_v3.WsAdmin" name="WsAdminPort" />
        </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Metadata">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
<system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
        <defaultDocument>
            <files>
                <add value="getUserInfo.aspx" />
            </files>
        </defaultDocument>
  </system.webServer></configuration>

在标题中传递用户名和密码以访问此Web服务,我可以通过以下方式实现,并且它可以在我的计算机上正常工作但在服务器上产生问题。

var client = new Five9API_v3.WsAdminClient();

                var loginCredentials = new ClientCredentials();

                loginCredentials.UserName.UserName = username;
                loginCredentials.UserName.Password = password;

                client.ClientCredentials.UserName.UserName = username;
                client.ClientCredentials.UserName.Password = password;

                client.Endpoint.Behaviors.Remove(client.Endpoint.Behaviors.Find<ClientCredentials>());
                client.Endpoint.Behaviors.Add(loginCredentials);

0 个答案:

没有答案