winform在部署后无法调用SOAP WS

时间:2016-03-09 17:17:21

标签: c# .net winforms web-services soap

我创建了一个完美的网络服务。我创建了一个小型winform应用程序来测试WS。 Winform应用程序也很完美。我将WS部署到SERVER,并尝试从其新地址调用WS,但是我收到以下错误

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

我的配置文件如下

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Service1Soap" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/Service1.asmx" binding="basicHttpBinding"
                bindingConfiguration="Service1Soap" contract="OdeAlWS.Service1Soap"
                name="Service1Soap" />
        </client>
    </system.serviceModel>
</configuration>

我可以在本地计算机上调用WS,因为我使用Visual Studio自动将WS添加到我的winform应用程序中。但是,现在我必须手动修复配置,因为我无法使用Visual Studio

访问SERVER

如何修复此配置,以便可以调用WS?

0 个答案:

没有答案