4

Hi
I wrote WCF duplex service. This service work Fine in Visual studio but when I publish this service and put it on IIS , Service don't answer to any Client.
All Client connect to this service Properly. Also they call Service Well and no exception occur.
Only different between with these services (IIS service and VS hosted service) is they address. For example :
* IIS service address is http://localhost/SmsService/SmsService.svc or better say is virtual path address.
* VS hosted service address is http://localhost:1408/SmsSrevice.svc. absolutely I changed Server address for client's.

Here Service/App Config's:
VS Hosted Service

<system.serviceModel>
<services>
  <service name="SmsService.Business.SmsService"
           behaviorConfiguration="ServiceBehavior">
    <endpoint address="http://localhost:1408/SmsService.svc"
              binding="wsDualHttpBinding"
              contract="SmsService.Business.ISmsService">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

IIS Hosted Service

    <system.serviceModel>
<services>
  <service name="SmsService.Business.SmsService"
           behaviorConfiguration="ServiceBehavior">
    <endpoint address=""
              binding="wsDualHttpBinding"
              contract="SmsService.Business.ISmsService">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Client Config

  <system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_SMSService"
             closeTimeout="00:10:00"
             clientBaseAddress="http://MyMachinName:10300/SmsClientService"
             openTimeout="00:01:00" 
             receiveTimeout="00:10:00" 
             sendTimeout="00:10:00"
             bypassProxyOnLocal="false" 
             transactionFlow="false" 
             hostNameComparisonMode="StrongWildcard"
             maxBufferPoolSize="524288" 
             maxReceivedMessageSize="65536"
             messageEncoding="Text" 
             textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32"
                    maxStringContentLength="8192" 
                    maxArrayLength="16384"
                    maxBytesPerRead="4096" 
                    maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="Message">
        <message clientCredentialType="Windows" 
                 negotiateServiceCredential="true"
                 algorithmSuite="Default" />
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://SERVER1/SmsService/SmsService.svc" 
            binding="wsDualHttpBinding"
            bindingConfiguration="WSDualHttpBinding_SMSService" 
            contract="ServiceReference.SMSService"
            name="WSDualHttpBinding_SMSService">
    <identity>
      <dns value="localhost" />
    </identity>
  </endpoint>
</client>

Even I wrote event log in first of service method but that's don't work!

so What is Problem?

Edit 1

First thank you all

Second I think, I don't explain my question clearly. "This service work Fine in Visual studio" refer to in VS I can communicate with server via client(on the same solution in VS with service). Client can call service and also service can call client, and the work fine(any calculation, callback's, database-actions and etc)

But When I publish that service which one do itself job properly in VS, into IIS that don't work fine(even in my own computer). This mean Client can create service object and connect to that IIS Hosted Service, but when client's call service there no event(calculation, callback's, database-actions) and Service also don't call Client's.

I don't understand, If any step of my code had error's that must occur in run-time in VS. So must be something i missed like security config, client side config or something else

5
  • Can you browse to the service discovery page successfully? Nov 24, 2010 at 9:39
  • Why is your clientbaseaddress and endpoint address on different hosts?
    – leppie
    Nov 24, 2010 at 10:06
  • @hero yeah I can see service. @leppie cuz my platform is network I run service in Server system and client on the mymachine. see my edit
    – Rev
    Nov 24, 2010 at 10:38
  • Are the clients going to be machines on the local lan i.e. inside the corp firewall, or any old client sitting out on the internet? Where is the client located that the service can't connect to?
    – Kev
    Nov 24, 2010 at 14:18
  • IIS hosted service on my Computer also client on my computer. even I run client in other computer(in same domain) but result is same.
    – Rev
    Nov 27, 2010 at 4:46

3 Answers 3

2

It could be the firewall that is blocking port 1408

4
  • @Bhaiji you helped me before(thanks again) but this is not the same issue. see my edit
    – Rev
    Nov 24, 2010 at 10:41
  • Your client endpoint is server1 and the base address does not match, could try changing them. Also check IIS logs to see if the request is reaching the server. Nov 24, 2010 at 11:02
  • this is Printed Wrong, In fact they are same. How check IIS log
    – Rev
    Nov 24, 2010 at 11:07
  • 1
    They are text files, the location will depend on your configuration, on my box they are in a subdirectory of c:\inetpub\logfiles Nov 24, 2010 at 13:52
2

First of all Duplex is bad (really bad) but I am not gonna blabber about that since you have made the decision to use it.

The main problem I can see is security. I am sure windows eventlog will tell you stories on this - just check the errors on security log. By default, IIS application pools are not allowed to communicate with other machines. You did not mention that you have specifically done anything about it so I assume it is all default. Just change the Identity of the App Pool to an admin user (al thought not recommended for production) and I think you will see your problem going away - I just guess.


OFF-TOPIC: WHY DUPLEX IS BAD

  • With server trying to establish a connection back to the client, it heavily reduces the scalability of the service. In fact if the client has a bad connection or ... server's connection could be hanging there until it times out during which time, all the resources dedicated to that call will be locked hence wasted.
  • Spec of the client machine and its connection can affect the performance of the service.
  • For server it is usually made sure that it is accessible. If client is behind a firewall or NAT, they can not contact the server. [THIS IN FACT COULD BE YOUR PROBLEM].
  • So if you open up the client for the server, it means the client could be also exposed to the whole world. Security considerations for the servers are usually good but the clients they are ignored so whole lots of things now need to be considered.
  • And there are more... but that should be enough.

9
  • 1
    why it is bad? Duplex idea is great . mean WCF-duplex isn't good tool?
    – Rev
    Nov 24, 2010 at 11:09
  • Also there is no security log in event viewer
    – Rev
    Nov 24, 2010 at 11:12
  • I will give you some pointers to why it is bad later today. On the other hand, please update your question with these info: IIS version, .NET version, IIS App Pool identity, aspNetCompatibility=?, if server and client are on both machines.
    – Aliostad
    Nov 24, 2010 at 11:46
  • 2
    I have added reasons why Duplex is bad.
    – Aliostad
    Nov 24, 2010 at 13:47
  • @Ali how you use 2-way communication.should I change wsDualHttpBinding to Tcp binding
    – Rev
    Nov 27, 2010 at 4:48
0

can you open http://localhost:1408/SmsSrevice.svc in your browser? If not check your IIS configuration. http://msdn.microsoft.com/en-us/library/ms733766.aspx

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.