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

发布于 2024-10-02 12:50:06 字数 2106 浏览 1 评论 0原文

我正在尝试使用一项服务。我正在尝试将其部署到服务器并使用它,但出现此错误。我创建了一个 Web 应用程序并添加了 wcf 服务。我得到这个

服务器堆栈跟踪: 在System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest请求,HttpWebResponse响应,HttpChannelFactory工厂,WebException响应异常,ChannelBindingchannelBinding) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan 超时) 在System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时) 在System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime 操作、Object[] ins、Object[] outs、TimeSpan 超时) 在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作) 在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

在 [0] 处重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型) 在 IBusinessV1.CheckForUpdate(String currentVersion) 在 BusinessV1Client.CheckForUpdate(String currentVersion)

我的配置有问题吗?

<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>

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. 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)

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)

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤千羽 2024-10-09 12:50:06

好吧,所以你确实显示了服务器配置,但你从未真正告诉我们错误是什么 - 你显示了堆栈跟踪 - 但没有显示错误消息......

无论如何,看看你的服务配置,有一件事似乎有点odd - 您的服务地址:

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

通常,这可能是

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

您在 IIS 中托管服务,或者是

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

在 Windows NT 服务中自行托管。

您能否仔细检查您的地址 - 您是否 100% 确定它是正确的?

更新:此外,您正在使用https://,但是,您没有在服务配置中显示任何安全设置。仅用于测试:当您将配置中的服务地址更改为 http:// 时,您可以调用您的服务吗?

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

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

if you're self-hosting in a Windows NT service or something.

Can you double-check your address - are you 100% sure it's correct??

Update: also, you're using https://, however, you're not showing any security-settings in your service config. Just for test: can you invoke your service when you change the service address in the config to just http:// ??

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文