WCF service hosted on windows service not working on server - c#

I have a windows service working perfect. But when I deploy it on Windows server 2012, I am not able to browse it.
This page can’t be displayed
Make sure the web address https://localhost is correct.
Look for the page with your search engine.
Refresh the page in a few minutes.
p.s I don't have IIS installed on the server. Do we need that as I am hosting it in a Windows service.

Related

SharePoint Hosted App 2013 - ASPX with c# code behind

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.

Best Approach to communicate between a Windows forms application written in C# and Native Android App

so our company wrote an accounting app,in windows,using c# for a certain company that ordered an accounting application.
after a while,they requested an android app that can communicate with the server and request or send data from or to the database that the windows form application uses,which uses SQLExpress 2014.
note that : the application that runs on the android platform may need run on more than one client at any given time.
AND
the android app will be native.
my main question is this : whats the best technology to use?
do i HAVE to use web services ?
well to do that i have to install IIS on the windows client which is
all im trying to avoid,because i have a setup and the program has been
mass produced within the city so i cant just take back every
customer's product and add iis setup procedures to the setup...if u
know what i mean
Not true. Since WCF days, there's an in-process option called XXX self-host which is a tiny web server written in C# and started along with your process using code.
Currently your best web should be developing your Web services using OWIN/Katana self-host and implement your RESTful service running on a Windows service (did you know about TopShelf?).
Check this interesting MSDN article to learn more about self-hosting a Web API into a Windows Service using Topshelf.
TL;DR
Your best bet here would be creating a Windows service which might be installed along with the Windows application or in some customer's server machine and host this way your RESTful Web service using ASP.NET Web API.
This is easy to deploy and distribute, and your customer won't require an IIS installed to host web services.

iPhone, WMI, iis service

I am thinking about writing an application that will monitor IIS Service with iPhone, and send notification, perform resets if an IIS goes down.
I dont want to create a web service to do that but rather connect to a machine, specifying credentials and then get data from the IIS Service state.
Is it even possible?
Is it possible with iPhone?
I need to make this app generic enough for people to use with their hosted web sites and monitor their health and being able to reset it and/or recycle AppPools. I cant implement a service for any hosted environment. I need to be able to give the iPhone users an ability to connect to their host and once you are connected to the machine and authenticated to perform WMIs the phone users can mess with the iis. Is it possible?
I see your point not wanting to use web service because you want to monitor and reset IIS service, while web service is based on IIS. How about RestFul service? I have created RestFul service based on OWIN (Open Web Interface for .Net) and Kayak. Kayak may have some examples there.
The cool thing about those tools or lib is that the framework is very simple and does not rely on IIS. You can provide two URLs, one for get and one for post. The former is to get status of IIS server and post is to reset IIS. Those services can be just XML of JSON based objects and it will be up to the the OWIN service to do the job on the back end. Another great feature of this is that you can even create the service in a console app or any other ways (Windows service or Window Form in system tray) on WindowsXP or Home version. The app will provide RestFul service based on HTTP with specific port.
RestFul service is available for variety of platforms, including iPhone.
Although IIS supports remote administration I doubt there's a way to implement it on the iPhone easily.
You could write an actual Windows Server (not a web service) you could connect to with a socket which can do all the monitoring instead though.

What is reason for doing IIS reset?

I have created an silverlight application and services. After i published it in
IIS(Win Xp or Win server 2003), i need to do an IIS reset to access that app. What may be the reasons?
Thanx in advance
Consider any Asp.net application deployed with some javascript version 1.0 and then after in development you changed the script and re-deployed ,if user don't hit refresh button,asp.net website will keep continue using script 1.0 ,so in this case either we ask user to hit refresh or else change the script version to 1.1 and re-deployed.As it was cached at client (browser)
Silverlight itself is client-side technology,when we request for any silverlight application it downloaded the xap folder (including dlls,client-side code).
Give try ,once you again deploy the Silverlight on IIS. Just Refresh the url,clear browser cache and see,it should work without IIS Reset.

Hosting non web based application in IIS 7

I have heard that you can host non-web based applications in IIS7 similar to windows services. Basically I want a C# app that is just a process running all the time to perform a specific function. I want to create a process that connects to the database at an interval and does some work.
I would like this whole app to be housed inside IIS. Is this possible? Can you provide me with links and resources to get me started?
WCF services can be hosted in IIS. Abstractly, think of them as webservices. Really much more, than that, but it gives you the gist. More information:
How to: Host a WCF Service in IIS
Why we use wcf rather than web services
How To: Hosting a WCF Service in IIS
Take a look at AppFabric it's Microsofts Application Server
http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx
http://www.hanselman.com/blog/InstallingConfiguringAndUsingWindowsServerAppFabricAndTheVelocityMemoryCacheIn10Minutes.aspx

Categories

Resources