Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
317 views
in Technique[技术] by (71.8m points)

c# - Mysterious Problem in WCF and IIS?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It could be the firewall that is blocking port 1408


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...