How to deploy REST Web Service using IIS - c#

I wrote a simple C# REST based Web Service by following
[https://www.youtube.com/watch?v=H9vBxAH4f5E]
When I copy folder to IIS and create application by Add Application, I am getting Error 500.
Is there something I am doing wrong ?
I have IIS v6 on Windows 7.
There is no main function, should I create console or web based application to render it ?
Any help or pointers will be great.

Related

Web API Missing on deployment

So I have a C# MVC Web API and Web Application that is an all-in-one project. I've created something similar to this in the past but the Web Application and Web API were two different projects with two different URLs.
For example:
The Web Application would be hosted at mywebsite.com/webapp
The Web API would be hosted at mywebsite.com/webapi
Any time I wanted to call the Web API from the Web Application all I had to do is send an Ajax request using the URL mywebsite.com/webapi/api/getdata
However, with my current project it's all-in-one. So in testing I would simply call /api/getdata and it would work just fine in Visual Studio debug. But when I deploy this site for testing and actually host it all my API calls are met with HTTP 404 errors.
So how do I call the Web API when the Web API doesn't have it's own distinct URL?
In IIS I converted the folder to an application and then made sure to switch the calls from
mywebsite.com/api/getdata
to
mywebsite.com/myproject/api/getdata
and it's working now.
Credit to #mxmissile for pointing it out.

Run C# MVC application, in local web server

I've made a C# ASP.NET Application using VS 2013. What I want to do is use it on my localhost using IIS.
How do I do it work? When it go to localhost, it just appears a black page.
I've created a new site on IIS Manager and ponted it to de fisical path of my application. Registered the ASP.NET on IIS...
I've tried whats in the How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network? .
So, I don't need to use IIS, I could use other web server, like Apache...
I want to be able to open Chrome, go to localhost:8080/ for example and get my application, without having to open VS and run the project etc...
Also, if other people could access the application on my local network, it would be great. I just want to use my MVC web aplication like it was on the internet itself, like I can access google.com and use it, but I want to do so in my local network only.
If I try to access a simple HTML file, using IIS, it works perfectly. Now I want to use my C# MVC web application.
Is there a way to do this? Using IIS, Apache, whatever...

ASP.NET, C#, RavenDB: error when running a web service located on another computer

Hello everyone.
I have implemented an ASP.NET web service that performs a query on a RavenDB database. I have then called this service by clicking on a button of a web page that is part of my web site and it is working just fine. I have generated a package from this web site. I have imported this package on IIS 8 located in another machine of the network I am connected to. On this other machine, when I launch the web site, is it working, but when I try to access the service by clicking on a button of a web page, I get the error displayed in the enclosed file. Is this error due to the fact that the web site is unable to locate the web service? If so, how can I fix it? If not, where does this error comes from?
Thanks in advance.

Cannot connect to AX Web Service form ASP.NET but can from Console Application

I am trying to connect to an AX-based web service through ASP.Net and C# but, when I publish my application, querying the web service results in "System.ServiceModel.FaultException: You cannot log on to Microsoft Dynamics AX." However, when I connect to the same web service through a C# console application, the querying works fine. I have copied the code from the console application into the ASP.Net application so that I have ensured that I have done nothing different.
I cannot figure out what the problem could be. I'm sure it's simple but I am at a loss. Any help?
This should be a permissions problem. When you launch the console app it executes through the current user (you, probably you have permissions to connect). When the asp.net site connects it uses an IIS user that needs to have permissions on AX too.

Problem to see Web Services running on local machine

I have written some web service, I run it and see it from my firefox and run it from there.
Now I want to call it from some other code/solution i trying to add there a web reference and Web Services on the Local Machine , but i cannot see there my web services.
Any idea what is missing ? Sorry for the newbie question it's my first time with web services.
Thanks.
when you run the web service you will get a url in browser.Copy that, in reference of your project Add Webreference , it will ask for the url paste it and click go.Add that to your project.
If you are not added in IIS. please add it to IIS and do the rest of operation.other wise when you try for that you wont get the web service.
Or run web service in visual studio debugger and dont close and to the operations.
please also ref: http://msdn.microsoft.com/en-us/library/d9w023sx(VS.80).aspx
If you created the Web service project in a file system, then it ll automatically assign the temporary port number to run the service. In this case you cannot see the service in other projects.
Try creating the IIS virtual directory for the web service and see.

Categories