Search code examples
c#winformswcfsetup-deployment

Issues in deploying wcf service library with windows forms


My problem is that when I run my solution, I had no problems

Here is what service output looks like

enter image description here

And when I make the my link to like this

enter image description here

And it is correct

But when I deploy the solution, install it using setup from the installer i created

I can still access, but output goes like this

enter image description here

And I try to navigate it, it looks like this and it is not right because it has no output

enter image description here

How can I fix it? I thought it is already ok because when I run it in visual studio it gives me expected output but when i deploy it is not.

Service App.Config

    <?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>

Solution

  • In the <behaviors> section you need to add

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

    And instead of

                <service name="WcfServiceLibrary.Service">
    

    write

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

    and try after this change in config.