Could not find endpoint element in .Config File - wcf

Good day to all,
We've encountered some configuration problem while retrieving an end point from configuration file at creating a ChannelFactory object.
Could not find endpoint element with name 'no matter service'
and contract 'no matter contract' in the ServiceModel client configuration section. This might be
because no configuration file was found for your application, or
because no endpoint element matching this name could be found in the
client element.
The usual solution at this kind of exception is to add .config file to exe that runs this code.
In this case we're running this code at com+ so i'd created dllhost.exe.config file with all the endpoints.
The intresting thing is that i'm using this service also from a client application and there my wcf platform founds the same endpoint without any problem.
Other endpoints at dllhost.exe.config working fine i think.
By the way the problematic proxy that uses this service is customised Enterprise Library code.
While debugging the code it is defenetly runs under the dllhost process.
Is there some way to find out it what config file it looks for the endpoint?
Thank you.

Well, after a few days of checking and testing we'd found out 2 ways to solve the problem:
dllhost.exe.config - should not be edited/created/updated manually,but from MSI.Probably the reason is that is is placed at system32 directory and windows blocks it.
Better way - is to create for COM+ Service Application Root Directory and place there 2 files
ServiceName.config - Contains list of endpoints
ServiceName.manifest - Contains 3 rows
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
</assembly>

Related

Unable to consume WSDL in Mule 4

I am using anypoint studio 7.3.1 with Mule 4.1.x. trying to load the WSDL using Web Service Consumer.
First I placed my WSDL file under src/main/resources of my project.
In Web Service Consumer, under connector configuration I selected my WSDL and at this point the mulesoft should automatically populate “Service”, “Port” and “Address”.
However that is not happening. I read somewhere that WSDL file needs to be exported to mule-artifact.json which I did, but still doesn’t work.
To make sure my WSDL is good, I was able to load the same WSDL in soapUI and was able to access the web service.
What is it that I need to do to get this working? Is there any error log that tells what’s going on? By the way, the endpoint is http so I know there is no cert issue.
the problem was due to the xsd that was referred in the WSDL. Removed that and it worked

WCF service is not communicating with silverlight4 application on Windows 8. IE 10. IIS 8.0

There are two modules one is silverlight application(like a client) and another one is wcf service which is self hosted service . Here both the application works like client and server communication. Those two applications are communicating properly in windows 7 and previous versions but not in win 8.
There is an error like "
An error occurred while trying to make a request to URI "localhost:8283/MyTestService". This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details."
I tried a many ways which i referred from internet but not able to create connection between them in windows 8.
I tried these ways :
1).added two files clientaccesspolicy.xml and crossdomain.xml to the IIS8(wwwroot) folder as referred by MSN..
2).Giver all permissions to respective folders.
what may be the possible solutions for this ?
1). any security issues might be there
2). windows 8 is enterprise edition
If any more details required let me know in comments.
I am looking forward for your respond..
After so much of R&D , i got the solution to work silverlight and WCF service in windows 8 environment. I am answering to my question if it may helpful to anybody caught in this type of error ..
Actual Cause :
No communication is creating in between CVT Service(WCF service) and CVT pages(silver light application) as client side. Whenever it compiled in windows 8 environment . Then the error caught was “ An error occurred while trying to make a request to URI ‘http://localhost:8283. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details. “.
Resolution :
The actual problem is present in WCF service . Below steps to be followed to run the WCF service successfully and make it communicate properly with silver light application in windows 8 environment. In windows 7 and previous versions the settings related to WCF service work will be enabled by default but in win 8 few features might not be enabled in that case you can follow these below steps.
step 1 :
create and add two XML files to wwwroot folder. This folder is located in this path “C:\inetpub\wwwroot”.
a). clientaccesspolicy.xml :
<xml version="1.0" encoding="utf-8">
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
</xml>
b). crossdomain.xml :
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>
Step 2 : If this feature is not activated , enable this feature by following the below steps.
Hit Windows+x.
Select Programs and Features(first item on list).
Select Turn Windows Features on or off on the left.
Expand .Net Framework 4.5 Advanced Services.
Expand WCF services.
Enable HTTP Activation.
Step 3 : Adding MIME Type and new managed handler
WCF services don’t run on IIS 8 with the default configuration, because the web server doesn’t know, how to handle incoming requests targeting .svc files. You can teach it in two steps:
Refer below link :
https://gyorgybalassy.wordpress.com/2012/09/24/
Step 4 : Application should be compiled in windows 8 environment .
We need to follow these steps to run this application in windows 8 environment.

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.

Why is this class library dll not getting information from app.config

I am developing a custom HttpHandler, to do so I write a C# Class Library and compile to DLL.
As part of this I have some directory locations which I want not hard coded in the app, so i'm trying to put it in the app.config which I've used before.
Before this has worked by just going building the app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Share" value="C:\...\"/>
</appSettings>
</configuration>
And then obtaining this in code like:
var shareDirectory = ConfigurationManager.AppSettings["Share"];
But when I compile it and put it in the bin folder for the webservice, it keeps getting null for shareDirectory, probably because it can't find app.config. So how do I make sure this is included so I don't have to hard code my direcotry locations? I notice it will essentially after compiled we get the assembly.dll and the assembly.dll.config which is the app.config file, so it's definetly there in the bin folder!
That is because your web service uses web.config
You're probably confusing the scope of your class library.
Remember, your config, be it web.config, or app.config, is the config present in the HOSTING application. In this case your hosting application is the WebService, hosted of course by IIS, so your config file is the web.config.
If you had a console app which somehow used that class library (though probably not in an http handler context), then the config would be the app.config in the console app, not the app.config in your class library.
You need to put the configuration in your web.config file, not in assembly.dll.config: .NET does not (by design) read assembly.dll.config files.

Disable proxy for entire application?

Ever since upgrading to Visual Studio 2010, I'm running into an issue where the first web request of any type (WebRequest, WebClient, etc.) hangs for about 20 seconds before completing. Subsequent calls work quickly. I've narrowed down the problem to a proxy issue.
If I manually disable proxy settings, I don't experience this delay:
Dim wrq As WebRequest = WebRequest.Create(Url)
wrq.Proxy = Nothing
What's strange is that there are no proxy settings enabled on this machine in Internet Options. What I'm wondering is if there is a way to disable proxy settings for my entire project in one shot without explicitly disabling as above for every web object.
The main reason I want to be able to do this is that I'm trying to use an API (http://code.google.com/p/google-api-for-dotnet/) which uses web requests, but does not provide any way to manually disable proxy settings.
I have found some information suggesting that I need to add some proxy information to the app.config file, but I get errors building my program if I make an edits to that file.
Can anyone point me in the right direction?
Brent - that's the correct solution : adding a defaultProxy element to your application's configuration file.
So for a website, it's the web.config. For an .exe application, it's .config.
And those settings are also correct :-
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<defaultProxy enabled="false" useDefaultCredentials="false">
<proxy/>
<bypasslist/>
<module/>
</defaultProxy>
</system.net>
</configuration>
Instead of turning off the proxy setting altogether you can try using the bypasslist to turn it off for the servers that you're having problems with.
See http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx for details and a sample.
If you're having problems changing the app.config I suggest posting the errors and possibly the app.config as well.