TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Krunal Mevada
NA
13
1k
Firewall : is inbound required for getting response while ou
Oct 14 2016 6:55 AM
I developed one MVC web application which have Web APIs and hosted in Amazon Instance and one windows application for calling those APIs for getting response from that server.
Both Web and Windows applications are developed in asp.net framework 4.5 using c# language.
Windows application is installed in more than 200 client's system which are highly secure servers it selves with all Inbound ports blocked in Firewall.
I am using HttpWebRequest with BindIPEndPoint for calling Web APIs using configured TCP port range [default 7777-7786].
API calls working fine from Windows Application if there are Allow Inbound and Outbound firewall Rules.
But the problem is clients are not allowing me any Inbound Firewall rules, they only allowing Outbound Firewall rules for those port range And Windows application is not working with blocked inbound rules for those port range.
Is it must I need to open Inbound Rule in Firewall for those port range for calling/getting request/response to/from APIs ? If no need of Inbound Firewall rule then please explain Why ?
Below is the
API call
which use one static TCP port in my
Windows Application
:
try
{
string
address = RevWatchURL;
address = address +
"api/GetRevGuardLatestPatch"
;
HttpWebRequest httpWebRequest = WebRequest.Create(address)
as
HttpWebRequest;
httpWebRequest.ContentType =
"text/json"
;
httpWebRequest.Method =
"POST"
;
httpWebRequest.Timeout = 300000;
httpWebRequest.ServicePoint.BindIPEndPointDelegate =
new
BindIPEndPoint(CommonValues.BindIPEndPointCallbackRGPatch);
string
enRevGuardUniqueId =
Encryption.EncryptionTechnique(Convert.ToString(UniqueId),
null
,
null
);
using
(var streamWriter =
new
StreamWriter(httpWebRequest.GetRequestStream()))
{
string
json =
"{\"UniqueId\":\""
+ enRevGuardUniqueId +
"\"}"
;
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
try
{
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using
(var streamReader =
new
StreamReader(httpResponse.GetResponseStream()))
{
returnVal = streamReader.ReadToEnd();
streamReader.Close();
httpResponse.Close();
}
}
catch
(WebException ex)
{
}
finally
{
httpWebRequest.Abort();
}
Obj = JsonConvert.DeserializeObject<CommonValues.RevGuardPatchClass>(returnVal);
}
catch
(Exception ex)
{
MessageBox.Show(
"Error"
,
"API"
, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
BindIPEndPoint Method:
public
static
IPEndPoint BindIPEndPointCallbackRGPatch(ServicePoint servicePoint,
IPEndPoint remoteEndPoint,
int
retryCount)
{
return
new
IPEndPoint(IPAddress.Any, 7777);
}
Reply
Answers (
1
)
download books not working for me
Certification for Web development