Error 404 - file not found on Silverlight RIA service call - silverlight-4.0

I have search everywhere for a solution to my problem, but I am not able to find one. I have built a Silverlight 4 Navigation app, and am using RIA Services to process a custom entity (which is essentially running server-side calls to COM dlls). In my debug environment, everything works fine, but when I try to deploy to IIS7 (on the development machine) as a website, it gives me the following error when calling the Get query on the entity:
Load operation failed for query 'GetNewHWCoil'. The remote server returned an error: NotFound.
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Everything I found online says to check the Authentication area on IIS and make sure that it is set only to Anonymous Authentication, which it is. And they also say to enable WCF logging, which when I add the necessary text to the web.config file, I still don't get any logs. They also say to use Fiddler2 to trace the HTTP calls, but I only get a 404 error on there with the textview giving me the standard IIS file not found website. I cannot figure out how to debug this problem.
The Silverlight app needs to make calls to a set of 3rd party COM dlls to calculate the performace of water coils. Since I do not want to have the app run OOB, (this will negate the whole point of it being a web app instead of a WPF app) I have the ASP.net project interacting with the dlls using the custom entities.
The function (or Query as RIA services calls it) GetNewHWCoil is located in the DomainService class and uses this code:
Public Function GetNewHWCoil() as HWCoil 'HWCoil is a custom object
If bRanCalc then 'bRanCalc is a global boolean variable that gets set to true if the calc call on the dlls have been made
Return mHWCoil 'global copy of the calculated coil object
bRanCalc = False
else
Return New HWCoil
end if
End Function
The error runs before any calculation should be called, so it is assumed that it is erroring on the 'Return New HWCoil' part.
Any help on this would be appreciated.
Thanks,
Chris

I found the solution to my problem. I fonud out that I can have VS run the debug from IIS, and when I had it create the virtual directory it told me I needed to install ASP.NET 4 on the server. I thought that by checking the ASP.NET checkbox in the Add Windows Features dialog that I had already done that. But it only installed .NET 2 version. So after looking online for this new problem, I found that I needed to run the command
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i
and everything worked fine after that.
Chris

Related

.NET CORE APIs and IIS (localhost) Internal server error 500

I have some issue with IIS on Windows 10.
I have 2 .net Core (v 3.1) API projects, simple for test.
First API project has controller witch return only string from constant. Second API project has controller and action, which call API from first project and return this value. Nothing else.
When I run both projects from Visual studio as multi project, everything works ok. I tested it by Postman. In postman I call api method from second project, it calls api from first project and return test string. Super. But problem is when I publish both project to ISS. Both projects are working. When I call method from first project it returns corret value. When I call some test method from second project it works. But when I call method from second project which is calling api from first project it faild with Internal server error 500. Only 500, no sub error. I add try catch into api and there is exception like this:
One or more errors occurred. (The SSL connection could not be established, see inner exception.)The SSL connection could not be established, see inner exception. at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at PetaAPI2.Controllers.PetaController.Index() in C:\Users\micha\source\repos\TestAPI\PetaAPI2\Controllers\PetaController.cs:line 24System.Private.CoreLib
Logs from IIS show only error 500 to, nothing else.
How I publish projects into IIS.
Created folder on disk for first project and next folder for second project.
From iis I add new Web. Select folder, set https and port 5010 for first api project.
From iis I add new Web. Select folder, set https and port 5011 for second api project.
Select SSL certifacate: IIS Express developer certificate. For both project same.
It is all.
Each API is runnig, but error 500 occured when I call api which call api from onather project (web). It works as multiproject run from Visual studio.
Any idea what can by wrong on my IIS site?
https://localhost:5010/test/test - OK, tested from Postman
https://localhost:5011/test/testexample - OK, tested from Postman
https://localhost:5011/test/callanotherapi - (it must only return data from https://localhost:5010/test/test) show interal server errror 500.
Im sorry about my english. Thank you,
Michal
Please check are sslPorts(from launchSettings.json) same.

Workflow WCF Service - Can't call from application - The request object expects an argument that I can't identify

I have created a WCF service using Workflow. It works just fine. I created another Workflow application to consume it. I added the service reference to the application project and rebuilt the project. I added the component from the service to the app, but it's expecting an argument that I never specified.
I've tried rebuilding both the service and the app, generating an entirely new solution and starting from scratch - same problem. I've looked at others' code and they've structured this project the same as mine but this issue does not show up on theirs. Googling this problem seems to bring up not results.
My workflow service is defined as such: https://i.imgur.com/E8mEfs6.png
The parameters of the receive component are: https://i.imgur.com/TaNRw2y.png
But when I add it to my app, the parameters are defined as: https://i.imgur.com/tqgEwNr.png
Which is not what I had defined in my service. I can't even figure out what it wants me to pass in for _GetCityStateFromZip. It says the type is InArgument.
I was expecting it to be expecting the zipcode parameter as I specified in the service. I think I might be adding the service reference incorrectly, but I don't know how. I went to Add Service Reference in Visual Studio, then copy/pasted the path to the .xamlx file of the service on localhost.
Thank you.
I found a solution to this problem here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5279fc5f-8a53-43e7-8ef2-3073808dc90f/configuring-workflow-services-how-to-configure-workflow-control-endpoint?forum=wfprerelease
I re-made my service using the steps listed and it works as originally intended.

WCF service operations not updated

I´m creating a new WCF service. I initially had only three operations. But after some time I decided to add two more. This operations doesn't appear in the Microsoft test client, neither in the list of operations when I try to add a service reference from my WPF client. Also I tried to comment one of the initial operations. It still apears in the Microsoft test client and can be invoked. I Tried also delete the dlls generated by the service and regenerate again. No luck. There are some kind of "cache" where Visual Studio stores the WCF services libraries that I can delete?
UPDATE: I'm working with the service running in the ASP.NET devolopment server.
You need to understand the order in which things happen.
You change your code, adding methods with [OperationContract] on them, or removing them, or changing their parameters or return values.
You then must build your service, producing a .DLL that contains the changes.
You must then deploy the changed DLL to the server it's going to run on
You must then restart the service (this may happen automatically depending on the server. For instance, IIS will recycle the service when it sees that the DLL changed)
You must then update your client, either the WCF Test Client, or "Add Service Reference", or the equivalent.
This last will have the effect of sending a request to the service for the new metadata or WSDL. Only then can the client see the changes you made to the definition of the service.
I don't know why, but I created a new project and copied the definitions of the operations from the problematic project and the problem is gone. One case more for Microsoft mysteries.
Make sure you are updating the services after adding the new operations.
Also make sure they have the attribute [OperationContract].
One thing we have discovered is that when you deploy the dlls that they must be in the bin, and cannot reside in the debug or release folder.
For me worked: just rebuild the wcf project
Did you close the client connection in client side
as showing your service
class Test
{
static void Main()
{
LocationClient client = new LocationClient();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
}
}
SOLUTION HERE :
Make sure your dataContract does NOT contain any enum
(You can use integer instead)
Be sure to reference a project in the solution and not a dll on your disk
Remove your "bin" and "obj" folders
Recompile
In IIS recycle the application pool
In IIS restart your service
In IIS "Browse" your service
=> You got it

WCF service deployed to Azure

I have create a WCF Service Web Role project.I can consume the service locally. But I am having issues trying to deploy the service on the azure cloud. After starting the webrole it justs kepps going in a loop where it init then stops. I have not made any changes to the default WebRoleclass that was added automatically. Can anybody point me to some samples or examples of WCF being deployed to azure
The behaviour you're seeing occurs when the instance errors in the OnStart or Run. The usual diagnostics error trapping hasn't had a chance to start yet so this is a difficult problem to debug. You might try adding error trapping inside this functions that writes the error details out to either a blob or a queue so that you can see what is actually happening.
Having said that, with code that works in the dev fabric, but continues to cycle when deployed to live, the first thing to check is that all of the references have the appropriate "Copy Local" property set. Anything that is part of the framework or Microsoft.WindowsAzure.ServiceRuntime will need to have Copy Local to false, everything else should be set to true (third party assemblies an the like). If this is a web role and you're using MVC, you'll need to check that System.Web.Mvc has Copy Local set to true as well as this is not included as part of the standard framework deployed in Azure.
Have you looked at the Known Issues information on the WCF Azure code page? There's a patch that's needed, as well as a tweak to the service behavior. Hopefully this will help you.
I just found out the root of the problem. It was caused by one of my projects having the target platform set to x86. Seems like it does not support x86 build assemblies which can be a problem

WCF can only serialize parameters on development machine

I have created a WCF service using vb.net. Everything works fine on my development machine but when I deployed it it failed with the following error
'There was an error while trying to deserialize parameter http://tempuri.org/:querys'
I call a single method on the service and it has a single parameter called 'querys'. This parameter was a list(Of CustomType).
I then created a new method with a single parameter of type ArrayList. Thinking that this should serialize. Again it works fine on my development machine but fails when I deploy it with the same error a above.
I am completely stumped how it can serialize a parameter on one machine and not on another. I've tried it on 2 other machine and it doesn't work on either of them. So that rules out a problem with the machine itself.
All machines are running Win XP and .Net v3.5. The service was developed using VB .net in Visual Studio 2008.
Has anyone else experienced this?
I have not included any code because the error is happening System.ServiceModel and as I mentioned above the code does work on the development machine.
Please let me know if you need any more information.
Thanks in advance
Did you mark your 'CustomType' and its fields/properties you want to serialize with attribute DataContract, DataMember?
When you add the service reference to your client app which setting do you use? (Reuse types in referenced assemblies, always generate message contracts...)
If you host the WCF service on a IIS, then you should remember to run this command on the servers.
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe /i /x
Thanks to everyone who replied,
I have resolved the problem but unfortunately do not how. I tried many code changes but as far as I can tell I have reset the code back to the way it was. It is working now and I can not spend any more time on the issue to find out what caused it.
Just one of those things I guess.