【问题标题】:Issues in deploying wcf service library with windows forms使用 windows 窗体部署 wcf 服务库的问题
【发布时间】:2013-05-03 06:40:08
【问题描述】:

我的问题是当我运行我的解决方案时,我没有任何问题

这是服务输出的样子

当我把我的链接变成这样的时候

这是正确的

但是当我部署解决方案时,请使用我创建的安装程序中的设置进行安装

我仍然可以访问,但输出是这样的

我尝试导航它,它看起来像这样,这是不对的,因为它没有输出

我该如何解决?我认为它已经可以了,因为当我在 Visual Studio 中运行它时,它会给我预期的输出,但是当我部署它时却没有。

服务应用程序配置

    <?xml version="1.0"?>
<configuration>

  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="WcfServiceLibrary.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.web>
    <compilation debug="true"/>
  </system.web>

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="NewBehavior0">
          <webHttp defaultOutgoingResponseFormat="Json" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="WcfServiceLibrary.Service">
        <endpoint address="" behaviorConfiguration="NewBehavior0" binding="webHttpBinding"
          bindingConfiguration="" name="Basic" contract="WcfServiceLibrary.IService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://PHWS13:8080/service" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>

【问题讨论】:

  • 您能否分享您的 web.config 以获取此服务?因为根据您需要在服务行为标签中添加 的消息。
  • @SandeepKumar,更新先生。
  • 也许您应该尝试在管理员模式下执行您的 winforms 应用程序? (右键单击并以管理员身份运行)
  • @HarshBaid,是的,它已经处于管理员模式。我只是困惑为什么当我在 VisualStudio 中运行它时没问题

标签: c# winforms wcf setup-deployment


【解决方案1】:

&lt;behaviors&gt;部分你需要添加

        <serviceBehaviors>
            <behavior name="NewSVCBehavior0"> >
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
            </serviceBehaviors>

而不是

            <service name="WcfServiceLibrary.Service">

            <service name="WcfServiceLibrary.Service" behaviorConfiguration="NewSVCBehavior0">

并在配置更改后尝试。

【讨论】:

  • 还是一样,部署时无法访问
  • 现在可能是IIS权限问题。您使用的是哪个版本的 IIS?在 IIS 5.2 中,您可以在主目录选项卡中设置执行权限。并将执行权限设置为“Script and Executable”
  • 对于 iis 7 你可以查看[这里] [technet.microsoft.com/en-us/library/cc725855(v=ws.10).aspx]
  • 我想我快到了,但收到此错误“由于 EndpointDispatcher 的 AddressFilter 不匹配,接收方无法处理带有 To 'phws13:8080/service/1/1/12345/1/1' 的消息。检查发送方和接收方的 EndpointAddresses同意。”
  • 对于 AddressFilter 不匹配,您需要在服务中添加以下属性 [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-08
  • 1970-01-01
  • 1970-01-01
  • 2012-01-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多