I want to create a common web module which act as a service to both .NET desktop application as well as web application (php, asp etc). Its main task is to get the input parameter from client page (can be webpage or desktop app), and do some calculations and provide the output to requested party (webpage/application). I have no experience implementing similar kind of environment and any help will be appreciated. I am using windows server and desktop application is developed in C#. Just wanted to create a common module platform for both environment. Creating a local copy of web hosted module for desktop application is preferred as it act as a copy of web module and only update when the user wants it.
The solution to your question is actually to create a Web Service here's how you can create a Web Service for visual studio
Create a asmx web service in C# using visual studio 2013
Your web service will have a method that accepts a DataSet to fetch the input of the user from the WebPage/Application(clientside) and will also have a method where it will pass the input it fetched (most appropriate is a DataSet) to the WebPage/Application you want.
P.S.
You need to Add Service Reference to the Project in the ClientSide WebPage/Application
Related
I have developed a C# windows application with Visual Studio 2013. It runs on a server and communicates with some devices around the world through a Apache server(txt files which contains commands). Now I would need to create a web page(accessible via the internet) which allows my customers to log in and change some parameters which are in my windows application.What would be the best way to do it?
Thank you in advance for your help!
Create a web page to save customer settings in database
Expose a webservice or Web API that can be called from the desktop application in a different thread to access the customer data from the web
i am new to visual studio, and i developing a distributed system with visual studio, i'm developing two applications
windows forum application c#
Web application asp.net
so i using WCF Services to make this system distributed, is is right?
in web application im using a WCF Services to Login and insert data and retrive data.
In your situation, i can say WCF would be fine. But in future if you are planning to support your application on devices like smartphones/tablets then Web API would be better choice.
But its totally depend on the situation. You will get more info on the following link:
http://www.dotnettricks.com/learn/webapi/difference-between-wcf-and-web-api-and-wcf-rest-and-web-service
Hope this will help you to choose appropriate option for your application.
I have a small question which ends in a big topic.
Is it possible - and yes how - to use C# code in a SharePoint 2013 Hosted App?
I tried to have a .asmx file within my project.
Then I get this error.
#"Error 1
CorrelationId: 9c1ea930-a131-4f5b-bff5-8a1a61fe34d9
ErrorDetail: There was a problem with activating the app web definition.
ErrorType: App
ErrorTypeName: App Related
ExceptionMessage: Microsoft.SharePoint.SPException: Exception from HRESULT: 0x81070964 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x81070964
And then I tried a few tutorials like...
http://chuvash.eu/2012/02/13/custom-httphandler-in-sharepoint-for-getting-dynamic-javascript-code/
http://blogs.msdn.com/b/kaevans/archive/2010/08/04/deploying-an-asp-net-httphandler-to-sharepoint-2010.aspx
http://social.technet.microsoft.com/wiki/contents/articles/24194.sharepoint-2013-create-a-custom-wcf-rest-service-hosted-in-sharepoint-and-deployed-in-a-wsp.aspx
But sometimes I didn't understand correctly or sometime I have other problems during compile everything.
I had a problem with getting assembly id/name, too. Because there was no compiled DDL File for the project.
What I want in general?
A .app file with a SP Hosted App (for SP 2013) which includes a web service for SP Client Object Model.
So I thinking about using the "default.aspx" with CodeBehind. So I could execute scripts "behind" the aspx. But then it couldn't find the assembly... Or there was something else.
Could anyone help me? If you have some ideas you could !please! provide them to me. Thank's!
SharePoint hosted Apps doesn't allow server side code to be excuted on the server, this is the whole idea of SharePoint Apps, nothing should be executed in the SharePoint Front End Servers. Unlike Farm solutions, SharePoint Hosted Apps runs on the client and can only access SharePoint resources through a predefined set of services that can be called either using REST or JSOM.
If you need a custom code, you can create a WCF service, deploy it under ISAPI and call it from your App, but this will not be doable in SharePoint online.
As for your question, you can use ASPX pages of course, but you will never put a code behind for it, as these pages are stored in a Pages Library and by design, it is stored in the content DB, so any code execution is denied.
Only aspx pages that are stored on hard disk like the _layouts pages can have a code behind.
SharePoint App runs in client context. You can create SharePoint App just using JS, HTML, CSS, JSOM. You cannot use C# for App (excluding CSOM, you can use it for creation remote event receiver for example)
If you need to implement some functionality to on-premise version of SharePoint, use traditional server-side solutions, not App.
It's important to understand the difference between SharePoint-hosted Apps and Provider-hosted Apps:
SharePoint-hosted Apps
SharePoint-hosted apps, or apps where all components are hosted on either an on-premises or Office 365 SharePoint farm. SharePoint-hosted apps are installed on a SharePoint 2013 website, called the host web. They have their resources hosted on an isolated subsite of a host web, called the app web. The App is created using HTML/JavaScript with CSOM or REST calls
Provider hosted apps
Provider-hosted apps for SharePoint include components that are deployed and hosted outside the SharePoint farm. They are installed to the host web, but their remote components are hosted on another server. The App run in a server that is external to SharePoint's. It has its own infrastructure and the Provider is responsible for keeping it running. They allow you to use Server Side code and uses the .NET CSOM.
This image will give you an overview of different Hosting solutions:
Visit the following link for more information:
https://msdn.microsoft.com/en-us/library/office/fp179887(v=office.15).aspx
The SharePoint Add-in model uses ASPX pages, which can also include ASPX controls. However any methods called are restricted to client-side scripting - i.e. JavaScript and SharePoint's JSOM (JavaScript Object Model), which is a subset of the Client Side Object Model.
I am a java developer and very new to C# and C++. I am trying to create a windows service in c# that another web application will call to close one of the projects in c++. I've created a dll file in c++ with a method to close the application.
I created a web service as specified in http://www.cjvandyk.com/blog/Articles/How-do-I--Create-a-Windows-Service-application-using-Visual-Studio-2010.aspx. However, I am not sure how to call this service from the web application.
Can someone advise me or refer me to some place where I can learn how to do this?
Not sure why you would want to go Windows service route. Your web application should be able to do everything on the server side.
If you have to use Windows service, you will need to expose some sort of service; e.g. wcf net.tcp service to accept calls for closing your app.
I would suggest you revisit your solution of using windows service.
You can try a software utility Application as Service by Eltima company. It lainchibg any application a s a service and offers different options. So If I've understood you right - it will help you.
http://download.cnet.com/Application-As-Service/3000-2094_4-10338474.html?tag=mncol;9
I have developed a C# Windows Service application with certain methods that I would like to call from an ASP.NET web application (it is important that there are these methods returning the result). My initial guess was that I could import the dll of the Windows Service into the web application, but I can find only the executable of the windows service, there's no dll at all.
Is it possible to compile the Windows Service into a dll? And if not, is there some other way I can reference my Web Service into the Web application?
Extract the common functionality into a class library project and reference it from both projects.
Is your windows service hosting a web service or does it just contain code that needs to be accessible in you windows service and web site?
If the former, then you can connect to it via the normal mechanims for connecting to a web service (e.g. adding a service reference in Visual Studio). If the later, then create a class library that both your windows service project and web project can reference (via Add Reference in Visual Studio).
You have two options. If you just need the code to be invoked, then you can call the windows service functionality via a custom action on the service, invoked from your code.
However, I gather that what you require is more complex, requiring a response as well. In this case, as per sga101, encapsulate the appropriate functionality into a separate class, and use this in both places. This means that the code projects should both be included in the same solution ( it is not strictly necessary, but it makes it easiest to keep the code matching ).