WCF REST Service aspCompatibilityMode not working in IIS - asp.net

Trying to deploy a wcf rest service inside of an asp.net web application. Works wonderfully when deploying to test server in visual studio, however when i deploy to iis 6 I get nothing. It is as if my service is not there at all.
here is my web config under system.service model:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
and im registering a route in the global.cs
routes.Add(new ServiceRoute("Service", new WebServiceHostFactory3(), typeof(WcfJQueryService)));
my web service class is decorated with:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
I am using windows authentication if that matters in this case...
Any ideas??

Got this to work via the instructions in this article...
http://hackprogrammer.blogspot.com/2009/01/installing-wcf-on-iis6.html
running aspnet_regiis -i for .net4.0 got me up and running

Related

Can't see detailed errors with Azure emulator

I have an Azure Cloud Service, with two web roles - one MVC, one Web Api. When I debug, it's running on Azure compute / storage emulator. I'm using IIS Express 7.5.
Both were working fine until I updated to Visual Studio 2013 Update 3 and Azure SDK 2.4. Now the MVC web role is fine, but the Web Api role just says 'The page cannot be displayed because an internal server error has occurred.'
I have tried adding:
<customErrors mode="Off" />
and
<httpErrors errorMode="Detailed" />
to the web.config, but to no avail. Where else can I try?

service is running in console application but not in web asp.net

I am consuming one service when i consume service in Console Application it works fine but same is not working in Web application .
Error: There was no endpoint listening at 'web service name here' that could accept the message. This is often caused by an incorrect address or SOAP action.
I tried to browse Service End points in Browser and i am able to get response.I am using visual studio 2012
Please help me.
Thanks,
Kapil
By adding below section in web config i am able to solve my problem.
<system.net>
<defaultProxy>
<proxy usesystemdefault="False"/>
</defaultProxy>
</system.net>

How to create or attach WCF service in existing asp.net web site

i have already a web site which is live and hosted in ORCS Web developed using asp.net form project type. now i am planning to develop a wcf service which will be stored in a new folder of my existing website. we will use wcf service for uploading file from client machine to our web server. client can be any other .net based web apps or .net based win apps. i never work with wcf in production environment. so i want to know can i create that wcf service which will be stored in a new folder of my web site or do i need to host that wcf service separately.
if i can store the wcf service in my existing web site then how to deploy it? if i copy the dll file of my site and svc in our web server after development and testing then it would be sufficient or not for creating proxy from client side. actually any how i have to create wcf service in my site. i can not deploy the wcf service separately out of my website. so guide me how to deploy and what are the files i need to copy to my web server because first time i will be going to do this. thanks
You can add wcf service to existing asp.net application.
Open solution explorer right click on asp.net app project and select "Add" -> "New Item" and then select "WCF Service".
VS will modify your web.config by adding something similar to this, wcf server configuration:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
And now about deploying solution. It's never a good idea to do partial deploy. Please read one of my posts about this subject What files to upload when making a change in a webpage

Service Reference in IIS

I know how to give service reference in Visual studio. Now I'm going to deploy the code in IIS server. there how to give Web reference (i.e Url of web service . Can any one help me.
In system 1 (Web application with web service) . system 2 (web application, web service has to fetched from system1). I can execute it in VS2008 because i can easily give service reference to system2 web application..
You don't need to add the reference again when deploying, but you may wish to change the address of the service, security information, quotas, timeouts, etc. All of this is configurable.
Web/service reference information is stored in .Net configuration files (e.g. app.config and web.config). When you deploy, you can change those values as needed to point to the correct location.
Example
Note the address attribute. This can be changed to the address where your endpoint resides.
<system.serviceModel>
<client>
<endpoint
address="http://localhost/SampleServer/PersonService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_PersonService"
contract="People.PersonService" name="BasicHttpBinding_PersonService" />
</client>
</system.serviceModel>

Hosting WCF web services on IIS - works in VS, but not in IIS

I'm very new in web programming stuff, so my question is about basics. I'm developing a SilverLight application and need to access the database from it. I'm using LINQ to SQL to get data from database and a WFC web service to deliver it to my app.
Everything is working fine when I'm running my app within Visual Studio. When trying to publish the web service to IIS - the web service call fails.
To make my question simple, I will focus on a brand new web service. Here the steps I'm doing:
Start Visual Studio 2008 -> File -> New -> Project -> Web -> WCF Service Application
Project Name: MyWcfService
Resulting Visual Studio generates a sample project with implemented Web Service "Service1"
Rebuild, start from Visual Studio (host on ASP.NET Development server)
--> Everything works fine, I see my service under http://localhost:52489/Service1.svc link
Now I want to host this service on my IIS (I've IIS7 on Vista x86 PC)
Visual Studio -> right click Project -> Publish -> target location -> Create new web app named "MyWcfService" -> Publish
Just to be sure check my C:\inetpub\wwwroot\ folder - now it contains the "MyWcfService" subdirectory with all required files.
Open IE on my PC http://localhost/MyWcfService/Service1.svc
The result is:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If > the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I were trying to remove "identity" section from web.config - same problem. Switching off the firewall does not help either.
Can anyone help me? What I'm doing wrong? Maybe I am missing something?
Per Nicholas Allen, Program Manager WCF/WWF,Silverlight # Microsoft:
What registration in IIS is responsible for processing SVC files?
There are two parts to the registration. One part is related to ASP.NET and the other part is related to WCF. The ASP.NET part is that the ASP.NET ISAPI has to be a service extension for IIS. The WCF part is that the HTTP handler has to be a managed handler.
The commands for setting up the two parts are "aspnet_regiis –i –enable" from the 2.0 framework tools and "ServiceModelReg.exe -r" from the 3.0 framework tools.
This results in a managed handler "System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and an ISAPI module "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" for *.svc files in IIS. In the IIS handler mappings, the managed handler has to be above the ISAPI module for this to work.
Together, the two parts start an HTTP pipeline and pass the resulting requests into WCF.
IIS will only direct requests to ASP .NET for certain files like aspx by default. I'm guessing that you don't have the svc extension mapped to asp .net. Try looking at this http://msdn.microsoft.com/en-us/library/bb515343.aspx.
Silverlight can only call web sevices in the exact same domain as the application (where the xap file lives)
To call a different domain you need to have a clientaccesspolicy.xml file where the web service lives. It's possible this is your problem.
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
You might not have ASP.Net setup properly in IIS. Take a look at this article:
http://msdn.microsoft.com/en-us/library/aa964620.aspx

Resources