端点未发现当ASP.NET主机 [英] Endpoint not found When Hosting in ASP.NET
问题描述
我得到端点未找到尝试通过在浏览器
访问我的服务时 的http://本地主机:10093 /服务/ Service1.svc
我收到错误:无法从 HTTP获取元数据://本地主机:10093 /服务/ Service1.svc 当试图从wcftestclient访问同一地址
如果我把在服务实现被击中一个断点,所以我想在SVC文件是否设置正确:
<%@ ServiceHost的语言=C#调试=真
服务=MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service
工厂=CommonServiceFactory.WebServiceHostFactory,CommonServiceFactory%GT;
下面是我的配置:
< system.serviceModel>
<服务和GT;
<服务名称=MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service
behaviorConfiguration =MainServiceBehavior>
<端点名称=newEndpoing
结合=basicHttpBinding的bindingConfiguration =
合同=MyApp.Core.Service.IMyAppService/>
< /服务>
< /服务>
<&行为GT;
< serviceBehaviors>
<行为NAME =MainServiceBehavior>
< serviceMetadata httpGetEnabled =真/>
< serviceDebug includeExceptionDetailInFaults =FALSE/>
< /行为>
< / serviceBehaviors>
< /行为>
< serviceHostingEnvironment multipleSiteBindingsEnabled =真/>
< /system.serviceModel>
在您的Solution Explorer中,打开你的 .SVC
通过使用查看标记,请确保您有是这样的:
... ServiceHost的语言=C#调试=真
服务=Yourservice.yourservicecodeBehind =yourservice.svc.cs%GT;
其中, Yourservice
是命名空间和 yourservice
是 .SVC 名称code>创建。
I get "Endpoint not found" when attempting to access my service via the browser at
http://localhost:10093/Services/Service1.svc
I get "Error: Cannot obtain Metadata from http://localhost:10093/Services/Service1.svc" when attempting to access the same address from the wcftestclient.
If I place a breakpoint in the service implementation it is hit, so I assume the svc file is setup correctly:
<%@ ServiceHost Language="C#" Debug="true"
Service="MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service"
Factory="CommonServiceFactory.WebServiceHostFactory,CommonServiceFactory" %>
Here is my config:
<system.serviceModel>
<services>
<service name="MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service"
behaviorConfiguration="MainServiceBehavior">
<endpoint name="newEndpoing"
binding="basicHttpBinding" bindingConfiguration=""
contract="MyApp.Core.Service.IMyAppService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MainServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
On your Solution Explorer, open your .svc
by using "view markup", make sure you have something like:
... ServiceHost Language="C#" Debug="true"
Service="Yourservice.yourservice" CodeBehind="yourservice.svc.cs" %>
Where Yourservice
is your namespace and yourservice
is name of your .svc
created.
这篇关于端点未发现当ASP.NET主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!