.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Problem to obtain client IP on web service

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

Friends,

I'm having problems to obtain the client IP on web service. Here's my scenario:

One server with Windows 2003, hosting the web service using .Net Framework 2.0, with IP 10.0.2.50 and host name ServerTransaction.
Other server with Windows 2003, hosting a web application using .Net Framework 2.0, that consuming the web service on  ServerTransaction, with IP 10.0.2.51 and host name ServerApplication.
Many other computers on the local network (IPs: 10.0.2.80, 10.0.2.81, 10.0.2.82, ...) acessing the web application on ServerApplication.

On the code of the web service I've tried to use HttpContext.Current.Request.UserHostAddress or HttpContext.Current.Request.ServerVariables("REMOTE_ADDR") or HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FORR"), but always I can only get the IP of ServerApplication (10.0.2.51).

Any idea or tip?


Thanks and sorry for my bad english.




View Complete Post


More Related Resource Links

WCF Service client problem.

  
Hi,I have hosted a wcf service over IIS with Windows Authentication. All the users are able to access the WCF service Url from their machine. The problem is that some of the user are able to consume the webservice method while few of them when try to consume the service ,the error is thrown connection - reset error.I have tried to go through the IIS log also but it did'nt helped.Can any one help me regarding this. What settings I need to check/change to solve the proble.Thanks,AKB

Problem with getting client's IP address in WCF service on IIS7

  

Hi,

I have deployed a WCF duplex service on IIS7 that gets the client's IP address and based on that if the IP address repeats, the client is not given access to service. The problem is that when I deploy it on IIS7 and try to access it from another PC on LAN, it identifies the new PC having the same IP address as the one that the service is deployed in(just for testing purpose, I am returning the retrieved IP address to client), and So, I am not able to access the service from another PC. 

Can anyone help me with this?

Thanks.

 


WCF durable service - retrieve token id on the client side problem

  

Hi,

I've created WCF durable service (service class marked as DurableService) with SQL persistent provider. The client invokes the service method marked as DurableOperation(CanCreateInstance:=True), after this - service successfully creates entry in the InstanceData table in sql database. Inside the service I can access the token id by using

OperationContext.Current.IncomingMessageProperties.Item("newDurableInstanceIdProperty")



 

If I understand the concept of WCF durable services, client could get this token and use it later to recreate the service state. Here I have:

Dim proxyActionParserService As New ActionParserService.ActionParserWorkerServiceClient



Dim contextManager As IContextManager = proxyActionParserService.InnerChannel.GetProperty(Of IContextManager)()



problem compiling web service

  

Using Visual Studio 2010.

I created a webservice GetDemographicData asmx, GetDemographicData asmx.cs and then used wsdl to create a proxy, then used csc.exe to create dll.

first time when I generate proxy, it looks and works fine, but when I make some changes to my webservice and regenerate proxy the following problems occur:

1.I lost the function: public DataSet Get_GetDemographicData(string CaseNum, int Version)
2. The namespace changed to my-labs

Why?? Please see my code below:

Any help is appreciated. Thanks.


<%@ WebService Language="C#" CodeBehind="~/App_Code/GetDemographicData.cs" Class="GetDemographicData" %>
GetDemographicData.cs was created under AppDataas follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for GetCurrentReportVersion
/// </summary>
[WebService(Namespace = "http://localhost/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, u

problem in consuming WCF service through Window application

  

I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0


now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error

::::

The document at the url http://72.44.172.77/HRDev3/Service.svc was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

  - The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'http://72.44.172.77/HRDev3/Service.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: 'http://72.44.172.77/HRDev3/Service.svc'.

Content Type application/soap+xml; charset

Smart Client: Building Distributed Apps with NHibernate and Rhino Service Bus, Part 2

  

Smart client applications are responsive and promote interactivity with the user. In this article, we continue building a smart client application using NHibernate for data access and Rhino Service Bus for reliable communication with the server.

Oren Eini

MSDN Magazine August 2010


Smart Client: Building Distributed Apps with NHibernate and Rhino Service Bus

  

Smart client applications are responsive and promote interactivity with the user. In this article, we start the processes of planning and building a smart client application using NHibernate for data access and Rhino Service Bus for reliable communication with the server.

Oren Eini

MSDN Magazine July 2010


Extreme ASP.NET: Client-Side Web Service Calls with AJAX Extensions

  

Microsoft AJAX Library and the ASP.NET 2.0 AJAX Extensions provide a number of compelling features ranging from client-side data binding, to DHTML animations and behaviors. Learn all about them here.

Fritz Onion

MSDN Magazine January 2007


Looking for a simple Service and Console Client REST sample implementing BASIC authentication

  

Does anyone know of a C# code sample demonstrating WCF REST services and console test client with OperationContracts (GET and POST) implementing mutiple paramaters using BASIC authentication? Also, perhaps, using Fiddler as a test client as well? I have searched high and low for something like this, but have not had any success.


passing object values from server to client problem

  

I get a message that x_login is not declared.  I added Dim login as String = "123", but that didn't help.  What's the problem?

code behind....

Dim Login = "123"
x_login.Value = loginID


asp....

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
   
<form id="simForm" runat="server" method='post' action='https://test.authorize.net/gateway/transact.dll'>
        <input id="HiddenValue" type="hidden" value="Initial Value" runat="server" />
        <input type='hidden' runat="server" name='x_login' id='x_login' />
        <input type='submit' runat="server" id='buttonLabel' />
 </form>

</body>
</html>


 


Problem with passing an Image as binary through web service

  

All

I have a web service that is accessed by a windows forms application and receives updates like facility name, address, image etc. Everything works fine except the image data is not being passed to the windows app. I am saving the images in database on both sides, so when I pull it from the server I use the following code

if (!reader.IsDBNull(floorPlanOrdinal))

facility.FloorPlan = (byte[])reader["FloorPlan"];

I can see the facility.FloorPlan Dimentions as 103840 when I debug this method which means that the data is pulled from the database fine.

On the forms side though the dimentions become 0, all other values pass fine except this. Here is the facility property in the web service on server side.

using System;

using System

Connection problem while connecting from client to server.

  
Hello, i am trying to connect sql server 2005 express using c#.net 3.5. my connection string is "Server=.\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\db_naren.mdf;Database=db_naren; Trusted_Connection=Yes;" this is working fine when i am connecting to sql server from the local machine. When i am trying to connect from someother machine to server it is giving error like A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) i added previliges in add new administrator on SQL Server 2005 Surface Area Configuration . and i made changes on SQL Server 2005 Surface Area Configuration  page, on Database Engine --> Remote Connections -->Local and remote connections --> Using both TCP/IP and named pipelines. still same error i am getting from client machine i am using connection string as "Server=MyServer\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\db_naren.mdf;Database=db_nare; Trusted_Connection=Yes;" is there any thing i need to do to connect from client machine to server?please

WCF client to WSE 3.0 service

  
Dear all,   I try to create WCF client to WSE 3.0 service. I have already working WSE3.0 client to the same service. Here is it's configurations:   <microsoft.web.services3> <security> <timeToleranceInSeconds value="10000"/> <x509 allowTestRoot="true" verifyTrust="true" storeLocation="CurrentUser"/> <binarySecurityTokenManager> <add valueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"> <keyAlgorithm name="RSA15"/> </add> </binarySecurityTokenManager> </security> </microsoft.web.services3>   And the policy for the service client created in such a way:   MutualCertificate10Assertion assertion = new MutualCertificate10Assertion() { EstablishSecurityContext = false, RenewExpiredSecurityContext = true, RequireSignatureConfirmation = false, MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt, RequireDerivedKeys = false, TtlInSeconds = 300 }; assertion.ClientX509TokenProvider = new X509TokenProvider(StoreLocation.LocalMachine, StoreName.My, "ClientCerfiticateName", X509FindType.FindBySubjectName); assertion.ServiceX509TokenProvider = new X509TokenProvider(StoreLocatio

WCF client to WSE 3.0 service

  
Dear all,   I try to create WCF client to WSE 3.0 service. I have already working WSE3.0 client to the same service. Here is it's configurations:   <microsoft.web.services3> <security> <timeToleranceInSeconds value="10000"/> <x509 allowTestRoot="true" verifyTrust="true" storeLocation="CurrentUser"/> <binarySecurityTokenManager> <add valueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"> <keyAlgorithm name="RSA15"/> </add> </binarySecurityTokenManager> </security> </microsoft.web.services3>   And the policy for the service client created in such a way:   MutualCertificate10Assertion assertion = new MutualCertificate10Assertion() { EstablishSecurityContext = false, RenewExpiredSecurityContext = true, RequireSignatureConfirmation = false, MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt, RequireDerivedKeys = false, TtlInSeconds = 300 }; assertion.ClientX509TokenProvider = new X509TokenProvider(StoreLocation.LocalMachine, StoreName.My, "ClientCerfiticateName", X509FindType.FindBySubjectName); assertion.ServiceX509TokenProvider = new X509TokenProvider(StoreLocatio

Error in consuming web service using WCF client

  
Hi, I have consumed an external webservice in my client application using WCF. And every thing works great in my Dev box(XP with IIS5.1) But when the same application is moved to Prod server(Win Server 2003 with IIS6.0) it fails. Below is the exception caught: There was no endpoint listening at http://MyExternalWebServiceUrlWithSessionId could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. And the InnerException is: Unable to connect to the remote server My Config file has the below settings:<system.serviceModel> <bindings> <basicHttpBinding> <binding name="Default_Binding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCoun

.NET Client and Java Web Service Interoperability

  
I have a .net client that consumes an operation on a java based web service that appears to work accept for an issue with passing Boolean values back to the service in the soap message. Any member of the complex type that are defined as Boolean in the service contract will not be present in the soap message generated from the client even though they are set in the code. Sample Client Code: UpdateChecklistItemStatusPortTypeClient     proxy = new UpdateChecklistItemStatusPortTypeClient();     updateChecklistItemStatusReq request = new updateChecklistItemStatusReq(); request.ouid =   "P000122112"; request.applicationId =   "00000032"; request.adminFunction =   "ADMA"; request.checklistItemTypeCode =   "UHSTRN"; request.ceebCode =   "052046"; request.transcriptTerm =   "FINAL"; request.transcriptScores =   true;     updateChecklistItemStatusRsp response = new updateChecklistItemStatusRsp(); response = proxy.UpdateChecklistItemStatusOp(request); Client Soap Message Generated: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   

Async Web Service behavior on client disconnect

  
Hi all, I was wondering what is the best way to detect client disconnect in the middle of an async web service call. I'm asusming that if a client disconnects while the server is still processing the async web method call, an exception will be thrown. First, I wonder if someone can confirm that this is the right assumption. If that's the case, then I was wondering where should I set up the SEH block to catch this exception. My gut tells me to set up the SEH block in side the delegate funciton, but I might be wrong. Also, what kind of an exception would I be getting if the client disconnects? Finally, if the SEH is set up in the delegate, what happens if a client disconnects in the tiny window before or after the delegate gets called? If someone can shed some light here I'd really appreciate it! Thanks, - K.  
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend