简体   繁体   English

尝试使用wcf服务,但我认为我的web.config文件不正确

[英]trying to consume wcf service but I think my web.config file is incorrect

I am having try trying to consume a service. 我正在尝试尝试使用一项服务。 I am trying to deploy it to a server and consume it however I get this error. 我正在尝试将其部署到服务器并使用它,但是出现此错误。 I have created a web application and added a wcf service. 我创建了一个Web应用程序并添加了wcf服务。 I am getting this 我得到这个

Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.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) 服务器堆栈跟踪:位于System.System.ServiceModel.Channels.HttpChannelFactory.HttpRequestFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)处的System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest请求,HttpWebResponse响应,HttpChannelFactory工厂,WebException responseException,ChannelBinding channelBinding) System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时)处的System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔型单向,ProxyOperationRuntime处的.ServiceModel.Channels.RequestChannel.Request(消息,TimeSpan超时) System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime operation)处的操作,System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)处的Object [] ins,Object [] outs,TimeSpan超时

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IBusinessV1.CheckForUpdate(String currentVersion) at BusinessV1Client.CheckForUpdate(String currentVersion) 在[0]处抛出异常:在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage位于BusinessV1Client.CheckForUpdate的字符串currentVersion)(字符串currentVersion)

Is there something wrong with my config? 我的配置有问题吗?

<system.serviceModel>
   <services>
      <service name="SP.WebWCF.Business_v1">
          <endpoint 
             address="https://services.mydomain.com" 
             binding="basicHttpBinding"
             bindingConfiguration="" 
             contract="SP.WebWCF.IBusiness_v1"
             listenUri="/" isSystemEndpoint="true" />
      </service>
    </services>
    <behaviors>
       <serviceBehaviors>
           <behavior>
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
           </behavior>
       </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Ok, so your did show the server config, but you never really told us what the error is - you show the stack trace - but not the error message..... 好的,所以您确实显示了服务器配置,但是您从未真正告诉我们错误是什么-您显示了堆栈跟踪-但没有错误消息.....

Anyway, looking at your service config, one thing seems a bit odd - your service address: 无论如何,查看您的服务配置,似乎有些奇怪-您的服务地址:

address="https://services.mydomain.com" 
binding="basicHttpBinding"

Typically this would either be something like 通常情况是

address="https://services.mydomain.com/MyServiceVirtualDir/MyService.svc" 

if you're hosting your service inside IIS, or something like 如果您将服务托管在IIS之内,或者类似

address="https://services.mydomain.com/MyService" 

if you're self-hosting in a Windows NT service or something. 如果您要自托管Windows NT服务或其他内容。

Can you double-check your address - are you 100% sure it's correct?? 您能仔细检查一下您的地址吗?您是否100%确定地址正确?

Update: also, you're using https:// , however, you're not showing any security-settings in your service config. 更新:同样,您正在使用https:// ,但是,您未在服务配置中显示任何安全设置。 Just for test: can you invoke your service when you change the service address in the config to just http:// ?? 只是为了测试:将配置中的服务地址更改为http://时,可以调用服务吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM