Mono 上的 WCF 托管问题
我正在尝试托管一个简单的应用程序,每个应用程序都有一个 .aspx、.asmx 和 .svc 文件。我按照下面的指南来实现托管(因为我对 Linux 世界非常陌生,所以花了一段时间才理解它!):
http://www.mono-project.com/Mod_mono#Manual_Mod_Mono_Configuration
完成所有托管后,我可以访问 aspx 和 asmx 文件。但是,当我尝试访问 svc 文件时,出现以下错误:
ServiceHost 必须至少有一个由配置、行为或对 AddServiceEndpoint 的调用定义的应用程序端点(不包括元数据交换端点)
或
HttpListenerContext 与任何已注册的通道都不匹配
我确实在 web.config 中定义了一个非常简单的服务端点如下所示:
<system.serviceModel>
<services>
<service name="TestWCFService">
<endpoint address="http://localhost/MonoTest/TestWCFService.svc" binding="basicHttpBinding"
contract="MonoTest.ITestWCFService"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
你能告诉我我做错了什么吗?
注:我使用MS VS 2010创建这个项目,然后发布它。发布的目录将复制到 Apache/Linux 环境。 WCF 不使用任何复杂类型。我正在使用 Mono 版本 2.8.2
更新 更新:我尝试使用 2.10.2 Mono。这个错误消失了,我现在面临一个新的错误:
XmlSchema error: Named item http://tempuri.org/:DoWork was already contained in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related schema item SourceUri: , Line 0, Position 0.
I am trying to host a simple application with one .aspx, .asmx and .svc file each. I followed the below guide to achieve the hosting (since I am very new to the linux world, it took a while to understand it!):
http://www.mono-project.com/Mod_mono#Manual_Mod_Mono_Configuration
After all the hosting, I am able to access the aspx and asmx file. But when I try to access the svc file, I get the below error:
The ServiceHost must have at least one application endpoint (that does not include metadata exchange endpoint) defined by either configuration, behaviors or call to AddServiceEndpoint methods.
or
HttpListenerContext does not match any of the registered channels
I do have a pretty straight forward service endpoint defined in my web.config which looks like below:
<system.serviceModel>
<services>
<service name="TestWCFService">
<endpoint address="http://localhost/MonoTest/TestWCFService.svc" binding="basicHttpBinding"
contract="MonoTest.ITestWCFService"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Can you please tell me what I am doing wrong?
Note: I used MS VS 2010 to create this project and then published it. The published directory is copied to the Apache/Linux Environment. The WCF doesn't make use of any complex type. I am using Mono Version 2.8.2
UPDATE
Update: I tried using 2.10.2 Mono. This error is gone and I am now facing a new one:
XmlSchema error: Named item http://tempuri.org/:DoWork was already contained in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related schema item SourceUri: , Line 0, Position 0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过几周的研发,我已经弄清楚了这一点。由于某种原因,我无法让服务 WSDL 工作(这意味着我无法从浏览器访问 .svc)。但是,当我尝试使用 Channel Factory 访问该服务时,该服务工作正常。
所以我已经在 Channel Factory 中实现了所有内容(对于我的 Silverlight 应用程序),现在一切似乎都工作正常。我仍然不确定如何让 WSDL 工作,但这对我来说目前还不太重要。
After weeks of R&D on this I have figured out this. For some reason, I can't get the service WSDL to work (meaning I can't access the .svc from browser). However, the service works fine when I try to access it using Channel Factory.
So I have implemented everything in Channel Factory (for my Silverlight app) and everything seems to be working fine right now. I am still not sure how to get WSDL to work but that's not too important to me as of now.