我有一个使用对类库的引用的 WCF 服务。该库中的类执行与数据库交互之类的操作。我正在通过浏览器使用 restful 调用测试我的服务(编译时没有错误),它只显示一个页面,上面只显示“找不到端点。”。我假设这与库引用连接字符串和应用程序设置等(我通常必须包含在使用该库的应用程序中)的事实有关。所以我很难找到的是如何正确配置 wcf 服务以使用这个库。我尝试简单地将连接字符串和应用程序设置添加到 wcf web.config,但这似乎没有帮助。我觉得这只是通过服务的端点部分添加对库的引用。但我迷路了。任何帮助表示赞赏。谢谢
<system.serviceModel>
<services>
<service name="RestService.RestServiceImpl" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name ="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
更新:运行跟踪,这是抛出异常的堆栈跟踪:
System.ServiceModel.Dispatcher.HttpUnhandledOperationInvoker.Invoke(对象实例,对象 [] 输入,对象 []& 输出) System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime。ProcessMessage11(MessageRpc& rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk。 UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueueServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler .HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) 系统。 Runtime.AsyncResult.Complete(Boolean completedSynchronously) System.Runtime.InputQueueServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler .HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) 系统。 Runtime.AsyncResult.Complete(Boolean completedSynchronously) System.Runtime.InputQueuerpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueuerpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueueDispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete( IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueueDispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete( IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueueAsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueueAsyncMessagePump(IAsyncResult 结果) System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult 结果) System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult 结果) System.Runtime.AsyncResult.Complete(布尔完成同步) System.Runtime.InputQueue1.AsyncQueueReader.Set(Item item)
System.Runtime.InputQueue
1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread) System.Runtime.InputQueue1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread)
System.ServiceModel.Channels.SingletonChannelAcceptor
3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread) System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action回调) System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult结果) System.ServiceModel.Activation.HostedHttpRequestAsyncResult。 HandleRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(对象状态) System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) System.Runtime .Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 错误,UInt32 bytesRead,NativeOverlapped* nativeOverlapped) System.Threading._IOCompletionCallback。PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)