开发者

cant access my WCF service thru other machine in the same network

I wrote the most simple wcf service that have one method

// return a+b
int ICalc::add(int a, int b) 

When I try to access the service through local machine - I get the result with no problem. But try to access from other machine i cant get the service.

I try to define

<security mode="None"/>

from the client machine.

I try to define web page 'default.htm' to see if I can access and see the web page (to be more clear .. I can access and see the default.htm page).

I try to access using the IP and using the machine name - but nothing! Nothing work.

I define my service as WAS.

Someone can help me here ?

Service web.config file: ( 192.168.1.117 is machine ip - but I try also using localhost and machine name .. nothing help )

<system.web>
  <compilation debug="true" targetFramework="4.0" />
  <httpRuntime maxRequestLength="10000000" />
</system.web>
<system.serviceModel>
  <services>
    <service name="ServiceLibrary.ServiceProxy" behaviorConfiguration="ServiceBehavior">
    <endpoint address="" binding="wsHttpBinding" contract="ServiceLibrary.IServiceProxy">
        <identity>
          <dns value="192.168.1.117:50025"/>
        </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://192.168.1.117:50025/ServiceProxy/" />
      </baseAddresses>
    </host>
  </service>
</services>  
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Client app.config file : (here I also try to use the machine ip and try also use the machine name - I also try to disable the firewall of the client and the server ... nothing help)

 <system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IServiceProxy" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal=开发者_高级运维"false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false" >

              <security mode="None"/>

                <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                    maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://192.168.1.117/ServiceProxy.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IServiceProxy"
            contract="ServiceReference1.IServiceProxy" name="WSHttpBinding_IServiceProxy">
            <identity>
                <dns value="192.168.1.117" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>


You forgot the port in the client config file:

address="http://192.168.1.117:50025/ServiceProxy.svc"

Edit: in case it still fails, browse directly from the client machine to the address using browser: what do you get?

Also, what error do you get exactly?


I added the port in the client config file - but its still does not help and i still fail to open the the service.

( fail in the r.open()

ServiceProxyClient r = new ServiceProxyClient();
r.Open();

)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜