Deploying wcf with silverlight application? - wcf

I am trying to deploy a Silverlight application on a remote server. I've copied over the files within App.Web which includes the .svc file. I created a virtual directory within IIS 6.0 and am able to successfully host the silverlight portion.
BUT... now I am getting an error:
The type 'ServiceGateway', provided as the Service attribute value in the ServiceHost directive could not be found.
I've tried restarting IIS, verified that the ISAPI mapping for .svc extension is showing in IIS.
It seems to me that the service is not getting started.
Thoughts?

Missing a type sounds like it either wasn't compiled properly or the reference doesn't exist on the server. What version of .NET is installed on the server? It should be at least 3.0.

It looks like the service isn't getting started because you're missing the ServiceGateway type. You may be missing the entire assembly it's meant to be in.

Related

Blazor .NET Core app not deploying on IIS

I'm trying to deploy a blazor app on IIS following the article below
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-5.0&tabs=visual-studio
I've installed IIS version 10.0 using the following settings:
I then created the site and changed the application pool to No Managed Code
I created a new Blazor app and deployed it immediately without changing a thing (so I know there's not a problem with the code). Looking in the project properties it's using .NET Core 3.1
I noticed there was no web.config file when I built the Release version.
I copied the Release version to the website directory.
Browsing to the site gives me a 403.14 - Forbidden error.
I read in another article to try configuring the Mapping Handlers this was the current state of the handlers:
I added a module mapping like so:
I now get a 500 error:
The web.config file currently looks like this:
I then read to add this aspCore line to the configuration file:
After that it looks like it loads but with none of the formatting.
I assumed hosting a Blazor site on IIS would be a simple thing to do, would someone be able to point me to where I am going wrong?

Cannot fetch wcf service remotely

i have 2 systems, one is localhost(Windows 8.1Pro) and another is Virtual Machine(Windows server 2008R2).
i have a silverlight app hosted in VM which is consuming WCF service from localhost installed in windows service.
Problem:
silverlight is not getting clientaccesspolicy.xml and crossdomain.xml so wcf service will not fetched.
Tried solutions:
Added clientaccesspolicy.xml and crossdomain.xml in WCF service solution before installing but still it can't be fetched from WCFservice url.
Added clientaccesspolicy.xml and crossdomain.xml in C:\inetpub\wwwroot folder, as per my search so many suggested to place their which will be automatically fetched by silverlight.
tried adding clientaccesspolicy.xml code into wcf service as per this link still no success.
Any suggestions will be appreciated.
Edit:
okay i am attaching code FYR, i am doing this as below.
once i build WCFTest , 'll get .exe wcf installer which i am installing that using installutil.exe, so service'll be up and running in services.msc.
once i build TestSL, 'll get TestSLTestPage.html , on double clicking on this it'll open in IE, and on button click i should get "Hello World" from WCF.
Download it from here and suggest me if i am doing anything wrong. Attached projects are of exact same structure as i am workinig on....
Regards,
Jithendra
as i explained my prob.above i was using self hosted Wcf service and i couldn't solve the problem so Here's what i did
1. Created Default WCF Service application in VS2013 with all my code and added clientaccesspolicy.xml and crossdomain.xml in the solution.
2. Created a new website in IIS Manager to publish my project.
3. and published my project to IIS as filesystem.
4. There we'll have all the files that are necessary.
And Voila everything works perfect.
Hope it helps somebody.

wcf extension not invoked

Wcf extension is working fine on local iis. however,when i deployed it on windows server 2008, I got the following errors.
An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'ErrorHandlerExtension' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.
I left a space after each comma, but it did not work.
Pls give me some insight.
In general this could be caused by one of the following problems:
A difference in the configuration file between local iis and server
The dll containing the extension was not deployed to the server
The rights of the identity of the app pool on the server are limited
the solution for this case that I have solved : microsoft netframework version compatible. when I was installed the netframework 4.5 the problem has solved.

Unable to access WCF Service using InfoPath

I am consuming wcf service using infopath, I can easily access it through IE, but unable to access using InfoPath,
my wcf service is hosted on another server. I am getting this error :
WSDLReader:Could not find '/definitions/service' inside the '' namespace of the wsdl file. The parameter is incorrect.
- WSDLReader:Analyzing the WSDL file failed. The parameter is incorrect.
It was all working fine, but when server was restarted or shutdown, it has stopped working and am getting this error now. When I deployed the same webservice on the same server where my InfoPath form is, it was working fine.
Try to empty Infopah cache on client
How to do it more specifically depends on Windows and Infopath version/edition which were not given

Problem with type of service in ServiceHost directive in wcf service

I am developing a simple wcf service for test. When I test this service with my local IIS 7.5, then it works properly. But when I host it in web IIS, I receive this error:
The type 'WcfServiceLibrary1.Service1',
provided as the Service attribute
value in the ServiceHost directive, or
provided in the configuration element
system.serviceModel/serviceHostingEnvironment/serviceActivations
could not be found.
And my ServiceHost is:
<%# ServiceHost Language="C#" Debug="true" Service="WcfServiceLibrary1.Service1" %>
Please help me resolve this problem
Because I couldn't find this suggested in any of the questions I looked through for this, adding my case here:
I had this problem when I manually changed the namespace in the file MyService.svc.cs, and did not change the Service name in the corresponding file MyService.svc - turned out that it needed to be Service="namespace.classname".
Try using the assembly qualified type name.
This is [Fully Qualified Type Name], [Assembly]
Where [Fully Qualified Type Name] is, in the most common cases YourNamespace.YourType
And [Assembly] is, in the most common cases YourAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
It gets more complicated than this (generic types, nested types etc) - but unlikely to be so in your case.
If your application is using the default build options, then I'm going to hazard a guess that the directive should be something like this:
<%# ServiceHost Language="C#" Debug="true"
Service="WcfServiceLibrary1.Service1,
WcfServiceLibrary1,
Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=null" %>
Although you'll probably want to get rid of the newlines there.
Also, make sure your dll has actually been deployed
I had the same issue only when publishing my service but it worked locally.
It turned out to be that the service was referencing a DLL that wasn't being deployed. It's a super special case because it was a system dll (System.Web.Helpers) and thus the project didn't even have a reference to it and thus the "Copy Local" wasn't set to true.
IIS defaults to expecting to see the svc file in the virtual directory, and the binaries inside a bin folder (as marc_s commented).
However, the default build configuration for WCF Library projects is to build inside a bin/Debug folder (or bin/Release). You can change the Output Path to 'bin/' on the project properties Build tab.
Changing this resolved this error for me today.
I had this same problem after I deployed a working service to a new location (new site) in IIS. In inetmgr under the Default Website tree, I hadn't right-clicked the new site and selected Convert to Application - all working now!
Finally my problem solved.
I removed the service directory in my host and created a new virtual directory in the host space. Then I copied my service in new directory where I created it.
Now I can browse the .svc file for service and my client will consume the service.
I don't understand why this problem occurred! I am a little confused!
The answer marked as answer is very difficult to understand. In fact, although it led me to solve my similar problem, I don't know if that's because I accurately understand what the writer was meaning.
I was finding if I pointed an IIS application on my development machine to the actual project directory in which resides the web.config, MyService.svc, and bin folders necessary for the WCF Service Application it just wouldn't work, and was throwing this error. This is despite quadruple checking every setting and ensuring that things were equivalent to other simple, working WCF Applications.
Ultimately, I solved the problem by publishing to a different directory rather than depending on the project files and directory themselves.
Perhaps it was because the files were open in Visual Studio as I was trying to run the WCF application through IIS? I don't know, but the Visual Studio provided localhost:59871/... was working. I don't know if that instance is using the project files or a temporary published version.
Check whether namespace and class written in "Service" of "SeviceHost" is correct .It should be Service="namespace.classname" .
Another reason for this issue is often when a wcf service is moved from one directory to another, and the svc file has not been updated... easiest solution is to double check your .svc file and make sure the service definition is defined correctly.
As I can't up vote #jeromeyers answer at the moment, I want to add that this is the solution that I found for this issue.
Someone had copied and pasted a svc file and associated contract and code files to a new project, but they had not updated the namespaces and class names everywhere. Very frustrating tracking this down as it started with this error :
" name was started with an invalid character. Error processing resource 'file:///C:/...
<% #ServiceHost "
when trying to right click on the .svc file and doing "View in browser".
Even though this is slightly different than the question (not web iis): I got here through search because I was getting this error trying to Debug my service -- if you have multiple services inside a single solution, this error will occur if the solution in question is not built yet, and therefore the DLL not created when you try to access it. So to anyone out there make sure if running locally that the entire solution is built!
had this problem running a test project that was embedded in my solution.
I had to view in browser, then copy that link to a new service reference (delete the old one) then paste it in rather than using the discover utility button in the service reference.
Strange as well, after looking and trying others suggestions, i was still getting the error saying the:
The type ', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Sure we all get large project with a lot of DLLs. Turned out some of the older components in my solution were targeting .Net 4.5, and newer dll were build with 4.5.1. When the 4.5 dlls referenced the 4.5.1 dlls .... Not sure why i was the happy little guinea pig to be the first on my team to find this. While the fix was obvious and easy enough, just all the dlls to target the same .Net runtime.
Just wish Visual Studio would notice DLLs within the same solution should all target the same .Net runtime and generate a warning/error when building especially with we have a solution and a project reference and the runtimes don't match...
Be sure your compiled dlls are moved to service(IIS directory)
directory.
For example, sometimes Jenkins doesn't move them automatically.
I had the same issue when i uploaded my working localhost service to a new location on host.
I create a new Virtual Directory and published my Service to it via Visual Studio(FTP). Problem Solved.
It happend the same to me and the solution was creating a forder named "bin" and place the dll inside of it. Then, refresh the website on IIS and that's all
I had this problem too, and what did the magic for me was to restart the IIS.
This is a very weird error.
First time hosting WCF Service Application, in IIS ?
Many have solved their problems one way or the other. However if everything is your solution is correct and your error is about host your app in IIS, then ensure your physical path in IIS when you add your website is pointed to the "bin" directory of your solution as seen below in the screen shots.
Please look at https://msdn.microsoft.com/en-us/library/ms733766(v=vs.100).aspx
You need to do 2 things to be able to Host the Service on IIS, or even on Visual Studio's itergrated IIS_EXPRESS.
1) Update the Web.Config to include ServiceActivations
change:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
to
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
<serviceActivations>
<add service="API.Service1" relativeAddress="Service1.svc"/>
</serviceActivations>
</serviceHostingEnvironment>
2) You need to create a directory called App_Code in the root directory.
You now need to move the Service (ex: Service1.svc) from the root directory into the App_Code directory.
So you will have App_Code\Service1.svc
If you browse the Service
http://localhost:63309/Service1.svc it should work.