Securing a Java FX standalone application - javafx

I have created a JavaFX standaone application.
I cannot have it deployed in webserver, as some of the users do not have javafx runtime installed in their system. So, i package the application along with the javafx runtime and send it to them for use.
I am using persistence.xml to connect to the database. The password is saved as a plain text file.
So, i have to secure it.
Can someone please give an example of a standalone application accessing a datasource in application server using JNDI?
Would this approach allow for container managed connection pool handling?

Related

ASP.NET Core - Application not connecting to database after publishing

I created a simple ASP.Net Core application with user authentication (so all the Entity Framework has been preloaded into the web app template). It is connecting to my database with the connectionString that is located in my appsettings.json file, with "data source = {computerName}\\{serverName}" setup.
The database instance and Visual Studio are located on the same machine. This works fine in returning data to the web api while within development and debugging mode. When I publish it and try to go to the site from a domain name it does allow me to view the webpages that are not needing database connection but the rest that need data from the database returns pages like this:
Error.
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
I have tried to change the Environment Variables for ASPNETCORE_ENVIRONMENT from Development to Production to no success.
I have tried adding appsettings.Production.json to publishOptions in my project.json file, even though there is no file appsettings.Production.json, and this did not help. dotnet publish
Adding the evironment variable in the web.config file did not work Deployment
I need help getting the published web api to connect to my SQL Server database from outside the development Visual Studio setup.
The last thing I can think of is that maybe I am incorrect in how I understand the connection string. If the web api uses the connection string to connect to the database from the server-side then it should work just fine like it does when in development calling to http://localhost:port# since it's all on the same machine. But, if the database string needs to be based on a client-side call then it would have to be with domain names and IP addresses.
Can someone tell me which one it is?
The only thing else that comes to mind is that there is something I am not doing, and need to do, inside of IIS Manager. I see connect string there as well but unsure what that is for our does since the connection string is inside the application. Also maybe I am suppose to give the app some kind of authorization to communicate with the database server even though they are on the same machine???
After much research, finally googling "how to deploy a web api in iis" I was able to learn from Host ASP.NET Web API in IIS using Visual Studio Publish that I needed to add the security entity BUILTIN\IIS_IUSRS. Then placing a mapping to my database tables and giving db_datareader (and possibly db_datawriter) for the database to the IUSER to allow access from my self hosted IIS web api. This from the above mentioned link with the part stating
Accessing Database under IIS APPPOOL\ASP.NET v4.0
As we are using ASP.NET v4.0 App Pool make sure IIS APPPOOL\ASP.NET v4.0 is added to your Database Server -> Security -> Logins.

Deploying Application Insights bits to another server

I installed the Application Insight SDK from nugget packages and when I run the code I am able to log the telemetry data to cloud. Now I want to move these bits to my TEST server.Can I copy the bits directly to TEST server. after doing this, does the application logs the data to Azure?
I am using ASP.Net Application.I created Application Insight Resource in the cloud with the application type as ASP.NET.
The Application Insights SDK libraries should be deployable using XCOPY (i.e. just copy everything along with your application) without problems. Make sure to include your ApplicationInsights.config file and any changes to the Web.Config file as well.
However, remember that if you want to capture dependency calls in an IIS application, you will need to also install Status Monitor on the Test server as well.

Connections issues with MS Access to ASP.NET web application

I have hit a wall and can't figure out the heads from the tails. I am working with a team and we have developed an asp.net web application. There is a feature on the application that delivers directions from a database. The database is an MS Access database. I have published the application to an IIS7 Windows server. I also uploaded via FTP the Access database. We have tried all manner of connection string variants. We did not import the database in any way into Visual Studio but prefer to connect to where ever we decide to place it.
Now, I am wondering if using Access was a bad idea. Its a given that it was a rookie mistake since we are students working on our capstone project. Is there any other installs for the Access database that need to be installed on the server other than the driver for Access? Should my connection string be structured any other way that what it is presently? I will post the string below. Please note, I did not write this particular section of coding so if an error should be thrown it may be handled somewhere as to prevent the application from crashing on the user. Side note: Yes it does work fine on my local computer although the connection must be altered.
sConnection = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\inetpub\wwwroot\kioskApplication\www\Waypoints.accdb";
Thanks in advance for all the support and help with this issue.
Usually a WEB Application stores a file based database like MS-Access in its APP_DATA folder under the root of the site where every permission is granted to the IIS Service.
Then in your connection string you refer to this location using
Connection = #"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=|DataDirectory|\Waypoints.accdb";
See Where is DataDirectory
On the server side there is no need to install anything apart from the Microsoft Database Access Engine appropriate for the bitness of your web application. (32bit or 64bit)

Host WCF in a Windows Forms application

I have created a WCF service (DLL file), and I can use it when adding a service reference to it from my "adjacent" project in the solution.
I wish to make this WCF service accessible / host it, in a Windows Forms application. I need to use it from a remote location and need to access it via a URI. (IP address : Port !?)
What I am unsure of, is how to host it in the Windows Forms application? I have gone though many examples, but I can't quite get behind what needs to be done...
Do I add the DLL file reference to a new Windows Forms application, and somehow "shell" the DLL file?
Can I change my WCF service project type to a Windows Forms project? What needs to happen here?
I would appreciate some basic examples, that I could build upon. I have no preference for binding, but although I will now be accessing it from another remote Windows Forms application, ultimately, it will be accessed/used by a remote ASP.NET web application.
For now, I need to get it working on:
Remote Windows Forms application <---> (server) WCF service (hosted in its own Windows Forms application)
How can I do this?
If I understand correctly, rather that ASP.NET, it sounds like you are looking for self-hosting. See How to: Host a WCF Service in a Managed Application.
Your service can stay in its own class library; you only need to instantiate it from a Windows Forms project. For example, copy that Program.Main() into your Program.cs, replacing the...
Console.WriteLine("The service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
...lines with the...
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
...ones typically included in a Windows Forms project.
Try this...
Add the DLL file reference of your already-created WCF library to the new Windows application project and on any event, like a button click, try the following code.
ServiceHost sh = new ServiceHost("http://localhost:9092/MyService")
sh.open();
You can refer to the article Four Steps to create first WCF Service: Beginners Series.

Cannot access SOAP service when Flex 3 app is compiled

I've got a flex app that hits a remote SOAP service and populates a list with the results.
It works fine when i run it through flex builder, but when i compile the application and move it onto a webserver it can't access the services.
I've tried it from a standalone webserver and on my own machine. I'm assuming that there's a security issue that i've missed as i can't think of any other reason why it's ok in flex builder but not when compiled on the same box.
Thanks all.
Is it a crossdomain.xml issue?
The web server running the SOAP service needs crossdomain.xml file to allow your flash movie to access it. See http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

Resources