[英]Hosting first WCF Service on IIS
I have a web site hosted on IIS which works ok. 我有一个在IIS上托管的网站,可以正常工作。
In Visual Studio my project is called Geomaps. 在Visual Studio中,我的项目称为Geomaps。 It contains a web page that works fine and also a wcf web service. 它包含一个工作正常的网页和一个wcf Web服务。
The web service works fine locally on my dev machine but I am trying to host it on our remote IIS server. Web服务在我的开发机器上本地工作正常,但我试图在我们的远程IIS服务器上托管它。
I have no idea how to set this up I have tried various configurations. 我不知道如何设置它我尝试了各种配置。 The web.config in Geomaps is: Geomaps中的web.config是:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1"
behaviorConfiguration="MEX">
<endpoint
address="http://150.158.0.87:8000/MEX"
behaviorConfiguration="CountryProvinceBehavior"
binding="webHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CommentSessionIDBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MEX">
<serviceMetadata/>
</behavior>
</endpointBeahaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Can someone please help me. 有人可以帮帮我吗。 I am geting the below error: 我正在解决以下错误:
Cannot add the 'serviceMetadata' behavior extension to 'MEX' endpoint behavior because the underlying behavior type does not implement the IEndpointBehavior interface 无法将“serviceMetadata”行为扩展添加到“MEX”端点行为,因为基础行为类型未实现IEndpointBehavior接口
Try something like this: 尝试这样的事情:
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="MyMexServiceBehavior">
<endpoint address="http://150.158.0.87:8000"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpEndpointBinding"
contract="MyNamespace.MyIService">
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding"
maxBufferSize="9000000"
maxReceivedMessageSize="9000000">
<security mode = "None" />
</binding>
</basicHttpBinding>
<behavior name="MyMexServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://150.158.0.87:8000/MEX"
httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MEX">
<serviceMetadata/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.