【发布时间】:2015-11-11 19:49:21
【问题描述】:
我真的需要帮助。 我正在尝试第一次部署过去一个月一直在开发的 .NET WCF 应用程序。
我使用 IIS 7 作为我的 WCF 主机,并使用 wsHTTPBinding,因为我需要使用 Session 对象来存储凭据。我的客户是一个 WPF 应用程序,它使用 MVVM 模式和 Caliburn.Micro。
到目前为止,我设法(我认为)成功地在 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
【问题讨论】:
-
您需要在客户端尝试连接到服务的位置进行尝试/捕捉,然后在您的问题中包含异常信息,包括任何内部异常。
-
谢谢!请看我的更新!
-
是的。编辑帖子后立即找到它。从服务器 Web.config 中删除
。现在我只得到关于 WSReliableMessaging 的错误。
标签: c# wcf iis deployment