[英]I Cannot deploy my WCF service on IIS using WSHttpBinding
我真的需要这里的帮助。 我正在尝试部署过去一个月以来第一次工作的.NET WCF应用程序。
我使用IIS 7作为WCF主机,并使用wsHTTPBinding,因为我需要使用Session对象存储凭据。 我的客户是一个使用MVVM模式和Caliburn.Micro的WPF应用程序。
到目前为止,我(成功地)设法在IIS上成功创建了服务。 如果浏览“ http://localhost/Ohmio/OhmioService.svc ”, 则会看到“您创建服务”消息。 但是,当我运行我的客户端并尝试连接到它时,我的应用程序关闭,并显示错误消息“该应用程序已停止工作...” bla bla bla。
这是我的服务器Web.Config:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<system.web>
<compilation targetFramework="4.0"/>
<authentication mode="Windows"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="myBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="200" maxStringContentLength="8388608" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
<security mode="None" />
<reliableSession enabled="true" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="WcfService1.Service1Behavior" name="WcfService1.OhmioSVC">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="myBinding" contract="WcfService1.IOhmioSVC" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
这是客户端App.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IOhmioSVC" maxReceivedMessageSize="20000000"/>
<security mode="None" />
<reliableSession enabled="true" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/Ohmio/OhmioService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOhmioSVC" contract="OhmioSVC.IOhmioSVC" name="WSHttpBinding_IOhmioSVC">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
当然,我的应用程序可以在我的开发机器上正常工作。 请帮忙! 我什至不知道从哪里开始寻找原因。
谢谢!
编辑
好。 我按照建议放了Try catch,错误消失了:
例外:由于与远程端点进行了安全协商,因此无法打开安全通道。
内部异常:
该端点不接受操作,而仅允许处理WSReliableMessaging
我认为问题与可靠的会话有关(不确定性100%,但我的神经告诉我)。 我发现了一些文章,可以帮助您实现可靠的会话。
希望这对您有所帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.