[英]Asp.Net wcf service endpoint
I have a set of services in an asp.net service project. 我在asp.net服务项目中有一组服务。 I have configured the endpoints for them in web.config.
我已经在web.config中为其配置了端点。
This is how I setup the endpoints in web.config: 这是我在web.config中设置端点的方式:
<bindings>
<basicHttpBinding>
<binding name="GeneralBindingConfig" maxBufferSize="524288" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600">
<readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TeamTravel.Cloud.Services.ServiceContracts.AccountServices">
<endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IAccountServices" />
</service>
<service name="TeamTravel.Cloud.Services.ServiceContracts.JourneyServices">
<endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IJourneyServices" />
</service>
<service name="TeamTravel.Cloud.Services.ServiceContracts.JourneyTrackerServices">
<endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IJourneyTrackerServices" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
In IIS i mounted the website under this binding: www.teamtravel.com I also added the entry in my hosts file so that I can access the website locally from that url. 在IIS中,我在以下绑定下安装了网站:www.teamtravel.com我还在主机文件中添加了该条目,以便可以从该URL在本地访问该网站。
So based on the configuration I should be able to access a service like this: 因此,基于配置,我应该能够访问如下服务:
www.teamtravel.com/Services/AccountServices.svc www.teamtravel.com/Services/AccountServices.svc
AccountServices.svc are asp.net wcf services. AccountServices.svc是asp.net wcf服务。
But I get redirected to an error path: 但是我被重定向到错误路径:
http://teamtravel.com/default.aspx?aspxerrorpath=/Services/AccountServices.svc http://teamtravel.com/default.aspx?aspxerrorpath=/Services/AccountServices.svc
When hosting WCF service on IIS, the virtual directory where your service exists defines your service endpoint's address, so you can just leave this property empty: 在IIS上托管WCF服务时,服务所在的虚拟目录定义了服务端点的地址,因此您可以将此属性保留为空:
<endpoint address="" ... />
And you service will be reachable from www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc
. 您可以从
www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc
访问您的服务。
Address property may be used to add endpoints with addresses relative to that address: 地址属性可用于添加具有相对于该地址的地址的端点:
<endpoint address="anotherEndpoint" .../>
so this endpoint will be reachable from www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc/anotherEndpoint
因此可以从
www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc/anotherEndpoint
访问此终结点
For reference, read Deploying an Internet Information Services-Hosted WCF Service from MSDN. 作为参考,请阅读从MSDN 部署Internet信息服务托管的WCF服务 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.