在远程主机和服务参考上安装WCF
问题描述:
我想在远程主机上安装WCF并将我的桌面应用程序连接到它.我安装了WCF,但是当我尝试通过浏览器访问该服务时,它说:
Hi,
I want to install WCF on remote host and connect my desktop application to it. I install the WCF but when I try to access the service via browser it says that:
Metadata publishing for this service is currently disabled.
另外,我无法将服务引用添加到我的桌面应用程序.
Also I couldn''t add service reference to my desktop application.
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://xxx.xxx.xxx.xxx./test/test.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://xxx.xxx.xxx.xxx/test/test.svc. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.
Test.cs
Test.cs
namespace TestExample
{
public class Test: ITest
{
...
}
}
Test.svc:
Test.svc:
<%@ ServiceHost Language="C#" Service="TestExample.Test" %>
App.config:
App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="TestExample.Test">
<endpoint address="" binding="wsHttpBinding" contract="TestExample.ITest" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://xxx.xxx.xxx.xxx/test/test.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我想念什么?有什么建议吗?
提前谢谢!
最好的问候,
Blagovest Razhenkov
What I miss? Any suggestions?
Thank you in advance!
Best regards,
Blagovest Razhenkov
答
也许解决方案在这里?
http://stackoverflow.com/questions/2089304/wcf-how-to-enable-metadata [^ ]
Maybe the solution is here?
http://stackoverflow.com/questions/2089304/wcf-how-to-enable-metadata[^]