WCF web服务与Spring.NET找不到基址计划http [英] WCF WebService with Spring.NET could not find base address scheme http
问题描述
我搜索整个互联网来解决这个问题,虽然我觉得很类似的问题,他们都不是我自己的。这里的交易:
I search the entire internet to solve this problem and although I found very similar problems, none of them were my own. Here's the deal:
我想配置一个WCF Web服务(.NET 4.0和VS 2010)与Spring.NET 1.3.1。对于依赖注射。我使用的是IIS 7,现在的(但我可能需要在以后将其设置为一个不同的IIS)。
I want to configure a WCF Web Service (.Net 4.0 and VS 2010) with Spring.NET 1.3.1. for Dependence Injection. I'm using IIS 7 now (but I probably need to set it up for a different IIS later).
我不配置该用HTTPS运行(我可能会想在未来,但事实并非如此现在)。
I'm NOT configuring this to run with HTTPS (I'll probably want in the future, but that's not the case right now).
我第一次配置的WCF Web服务,而不Spring.NET和它的工作完美!
I first configured the WCF Web Service without Spring.NET and it worked perfect!
情景1:
然后我说这样的:
<object id="geoServiceWCF" type="ExampleProj.Web.WebServices.GeoServiceWCF" singleton="false" >
</object>
<object id="GeoServiceWCFServiceHost" type="Spring.ServiceModel.Activation.ServiceHostFactoryObject, Spring.Services">
<property name="TargetName" value="geoServiceWCF" />
</object>
...我得到以下异常: 找不到与绑定的WebHttpBinding端点符合计划http的基址。注册的基址方案是[]。的 (错误名为'GeoServiceWCFServiceHost创建对象)的
...I got the following exception: Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are []. (Error creating object with name 'GeoServiceWCFServiceHost')
和这里是我的web.config一部分WCF:
And here's my Web.Config part for WCF:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AJAXFriendly">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="geoServiceWCF">
<endpoint address=""
behaviorConfiguration="AJAXFriendly"
binding="webHttpBinding"
contract="ExampleProj.Web.WebServices.IGeoServiceWCF" >
</endpoint>
</service>
</services>
</system.serviceModel>
方案2:
如果我定义的地址=HTTP://localhost/ExampleProj/WebServices/GeoServiceWCF.svc的作为异常提示,我得到另一个错误: 的HttpGetEnabled财产的ServiceMetadataBehavior设置为true,并且HttpGetUrl属性是相对地址,但没有HTTP基址。无论是提供一个HTTP基地址或HttpGetUrl为绝对地址。的 (错误创建一个名为GeoServiceWCFServiceHost对象)的
If I define address="http://localhost/ExampleProj/WebServices/GeoServiceWCF.svc" as the exception suggest, I get another error: The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address. (Error creating object with name 'GeoServiceWCFServiceHost')
方案3:
然后,如果我设置的 httpGetEnabled =真正的的我得到的的访问被拒绝的错误。
Then, if I set httpGetEnabled="true" I get an Access denied error.
更多信息:一些问题试图注册的URL地址的http:// +:80 / ExampleProj / Web服务/ GeoServiceWCF.svc / (是的,用+符号)
More info: some problem trying to register the URL address http://+:80/ExampleProj/WebServices/GeoServiceWCF.svc/ (yes, with the "+" symbol)
摘要
我按照从Spring.NET文档中那么简单的步骤。我想我失去了一些东西,因为 我简直不敢相信,我不得不设置这么多奇怪的参数,使其工作。
I follow the so-simple steps from the Spring.NET doc. I think I'm missing something because I cannot believe I had to set up so many weird parameters to make it work.
对不起,长的问题,我想提供尽可能多的信息。
Sorry for the long question, I wanted to provide as much info as possible.
在此先感谢!
推荐答案
如果您使用的是* .svc文件,你必须更新配置定制工厂使用方法:
If you are using a *.svc file, you have to update it to configure the custom factory to use :
<%@ ServiceHost Language="C#" Debug="true" Service="geoServiceWCF" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %>
然后,不需要定义GeoServiceWCFServiceHost对象在容器中。这是不够的:
Then, you don't need to define the "GeoServiceWCFServiceHost" object in the container. This is enough :
<object id="geoServiceWCF" type="ExampleProj.Web.WebServices.GeoServiceWCF" singleton="false" >
</object>
- 布鲁诺
这篇关于WCF web服务与Spring.NET找不到基址计划http的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!