I have wcf iis hosted service.
I've created standard(from vs template) wcf service and its client. At client I add ServiceReference to my wcf service. All is good. No errors, web-form for this server works too. Next step I publish my wcf service to Win2003 IIS6.0.
I successfully go to http://server:1234/Service1.svc, see web-form, can check wsdl.
But when i run: svcutil.exe http://server:1234/Service1.svc?wsdl or add service reference I've got errors:
Error: Cannot obtain Metadata from http://server:1234/Service1.svc?wsdl
If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess. For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error URI: http://server:1234/Service1.svc?wsdl
Metadata contains a reference that cannot be resolved:
'http://server:1234/Service1.svc?wsdl'.
The remote server returned an unexpected response: (417) Expectation failed.
The remote server returned an error: (417) Expectation failed.
At my service config I have:
endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
serviceMetadata httpGetEnabled="true"/>
I can't understand problems.
Can you help me. Thanks a lot
Edit:
This answer was posted and isn't specifically useful to this question (any more) as it was based around a typo in the original question. That being said I still feel the information is useful here for people with similar problems that are likely to find this question in a search for their answer. If someone with the authority to remove answers feels that this needs removed - please feel free to remove it.
Original answer:
I'm not sure if this is helpful or not - I'm having a similar problem. Please notice that while you are accessing http://server:1234/Service1.svc ... further down in the error message it mentions that MEX endpoint is http://aurit-server:1234/Service1.svc... then, depending on how you have your bindings setup, it may be that aurit-server is not a valid endpoint for your service MEX... but server is or vice versa.
I know this isn't the full answer for you, I'm just pointing out something that I overlooked while troubleshooting my similar problem - hope it helps. I.e. aurit-server and server may not be interchangeable... they were not interchangeable in my case.
Edit:
Btw since posting this I've recieved an answer to a similar question that I posted. I strongly suggest you check it out incase it fixes your issue. Summary: It links to a blog post that details how to fix the issue I mentioned in my original 'suggestion' to you. If it helps you please make sure you vote Chesso up! (Chesso's answer to me, Blog post referenced in Chesso's answer).
I had this problem ("The remote server returned an unexpected response: (417) Expectation failed") when trying to add a service reference to a WCF service I'd deployed on another server. Turned out to be internet properties in this case.
Go to control panel -> internet properties, "Connections" tab.
Click the "LAN settings" button.
Uncheck "Automatically detect settings" and "Use automatic configuration script".
Click OK, apply / OK.
After that, I could add the service ref just fine. Worth a try if you have this problem.
Related
I'm testing the AppFabric cache feature in my website deployed from ASP.net MVC 4. In the web.config of my website, if I set the security level to anything except no security (None/None), like this
<securityProperties mode="Transport" protectionLevel="EncryptAndSign" />
then, getting cache from the method below will throw exception,
DataCacheFactory.GetDefaultCache()
Also, in the PowerShell Cache Management, I've already set the protection level to the same level (Transport/EncryptAndSign).
But getting cache still failed.
Exception message is as following,
ErrorCode(ERRCA0017):SubStatus(ES0006):There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable... )
The situation only happens in my deployed website. But if I run my website in Visual Studio debug mode, cache would response successfully no matter what the security level is set to.
OK! I finally solved the tricky issue. This tough thing nearly made me contribute my 50 bounties (almost half) !
After some survey, I found the first clue,
Security Error in APPFabric when changed the security mode from None to Transport?
(Note, I can't easily google it out from some keywords, but the result I want was easily dug out from Msdn AppFabric Cache forum. I thought google search can help me to find any answer.)
I got the same exception message as the first link. But Rahul's answer didn't work. However, Rahul's link revealed a second clue, that is, use Tracelog.exe to track the connection problem.
From the track log in Event Viewer, I found there are some error events saying my server's authority isn't accessible, so I searched in the third clue, Cache Administration PowerShell commands for setting permission in PowerShell.
In the third clue, thank the author, mark_og who really saved me ! You taught us how to set the permission in IIS like this,
Grant-CacheAllowedClientAccount "IIS APPPOOL\[AppPoolName]"
it's the key answer which solves my problem !
I have some WCF services which are running great locally; client can consume them and the server is putting data in the DB as expected. The problem is that when I deploy these to a staging machine, all I can see are HTTP 500 errors.
How do I start debugging the problem?
Given that it's only on staging and not on my local dev machine, I assume it's an IIS configuration problem somewhere.
When I use Fiddler to see what's being sent and what the response is, I can see (as expected) correct request data, and only a 500 as the response -- no further details.
I'm pretty green to WCF and IIS, so it's probably something obvious; I've used aspnet_iisreg, deployed my .svc file and all the built DLLs/files from bin; maybe I missed something.
I looked in the IIS logs, but they're pretty skimpy; no error information there, either (or maybe I'm looking in the wrong place?)
(More important than solving the specific problem is figuring out how to see enough details about errors so I can work through problems myself.)
Edit: I of course checked the event logs first -- and surprisingly, didn't find any mention of the exceptions. So I assume that the service is at least being invoked, and that something is faulting in the middle.
The first place to look for errors is event log on the server. There should be basic information why request was not processed. If it is WCF related you can turn on WCF tracing and check for more details in generated logs.
Add:
<httpErrors errorMode="Detailed"/>
In Web.config under:
<system.webServer>
And see what's happening in more details.
'Http 500 Internal Server Error' might occur if your Service Account's password got expired. Please make sure that you don't have any issues with Service Account which is running the app pool on IIS.
It turns out that the server was returning a 500 because of a huge dataset returned; WCF puts some limitations on the size of data (and strings) you can return, to prevent DOS attacks. I solved the problem by increasing the limits, and decreasing the size of data returned (where applicable).
Can anyone shed any light on this? I feel like I have wasted the entire day today hunting and searching the internet for any scrap of information about how to do this. I have created a very simple WCF RESTful service. It is basically a proof of concept. I have a simple database behind it and I am just trying to get it working so that I can view, create, update and delete items. Right now I only have view and update working. I'll tackle create later. For now I can't figure out why the delete doesn't work. Almost everything I have found so far tells me that I need to disable the WebDAV module. I did that and then I got PUT to work. But I can not get DELETE to work. Whenever I attempt to call DELETE through my service I get the following error:
The remote server returned an unexpected response: (405) Method Not Allowed.
So it seems like somewhere on my server it is not allowing the DELETE verb. But for the life of me I can not figure it out. I already checked the Handler Mappings and the handler allows all verbs for the .SVC extension. I have disabled WebDAV. I'm not really sure where else to look. I am using IIS 7.5 on Windows Server 2008 R2.
(I can provide code if it would help at all)
Thanks,
Corey
In case anyone having the same issue.
Here is another way you can try.
in web.config
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>
I just spent a ton of time trying to figure out why I kept getting 405 Method Not Allowed when using the DELETE verb. Everything I read said to uninstall WebDAV from IIS, but that seemed to break IIS in that all sites gave 503 errors. I reinstalled it, then went about looking in IIS for some setting.
It turns out that WebDAV is the problem, and it has a node on the IIS features page named "WebDAV Authoring". Clicking on that lets you then click on WebDAV Settings... to get the properties page. In the section Request Filtering Behavior, set Allow Verb Filtering to False seemed to do the trick for me (YMMV).
This seemed to be a popular result when googling for a solution, so I thought I'd add to the list of suggested solutions.
Open your website's Handler Mappings in IIS Manager
Edit each handler you want to DELETE with, clicking Request Restrictions, choosing the Verbs tab, then add DELETE to the "One of the following" list or, if appropriate within your concerns, allow all verbs.
You might need to restart your website and/or recompile your code
Well I'm not sure if this is really an answer to my question but it did solve the problem. I simply started a new project in Visual Studio and this time I used the .NET REST Service template that I found online. Then I transferred the old code I had from my previous attempt and used it in the new project. It worked like a charm. All four verbs work correctly now (GET, PUT, POST and DELETE). So it is working now.
Corey
When I try to test the AutoLotWCFService using "wcftestclient", I get the following error. What am I doing wrong? Any insight will help. This is a simple Web Service that has wshttpbinding with interface contract and the implementation in the service. Here is the long error message: The Web.Config file has 2 endpoints - one for Web Service itself and other for metaDataExchange. Its all pretty much default stuff. I can include the code if needed - it seems I cannot attach files here.
Error: Cannot obtain Metadata from http://localhost/AutoLotWCFService/Service.svc
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.
For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI: http://localhost/AutoLotWCFService/Service.svc
Metadata contains a reference that cannot be resolved: 'http://localhost/AutoLotWCFService/Service.svc'.
The remote server returned an unexpected response: (405) Method not allowed.
The remote server returned an error: (405) Method Not Allowed.
HTTP GET Error URI: http://localhost/AutoLotWCFService/Service.svc
The document at the url http://localhost/AutoLotWCFService/Service.svc was not recognized as a known document type.The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.
- Report from 'WSDL Document' is 'There is an error in XML document (1, 2).' -Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.
- Report from 'XML Schema' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'.
I recently had this problem whilst trying to host WCF on my Windows Vista Laptop under IIS7.
I first recieved the following error : "HTTP Error 404.3 - Not Found" and one of the resolutions suggested was to "Ensure that the expected handler for the current page is mapped."
So I added a handler for the .svc file manually and defined it as a DiscoveryRequestHandler, thinking that this might help. This caused the problem you described above.
The actual resolution was to delete the handler I had added, and to run the following commands:
CD c:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
ServiceModelReg -i
This resolved my issue and the service is working fine. I hope this might help shed some light on your problem. I can't be certain but this is probably because of the order in which I've installed the various packages on my dev laptop.
If installing compenonts doesnt work try a repair, this uninstalls and then installs.
"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
you need to make sure that the service behaviour configuration enables has a metadata tag with httpGetEnabled="true"
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true">
</behavior>
</serviceBehaviors>
In addition, make sure your service references that behavior.
<service name="blah" behaviorConfiguration="serviceBehavior">
Thanks; believe it or not the problem of at least loading the service through wcftestclient was solved when I re-registered the ASPNET in IIS with aspnet-regiis.
The next problem is to be able to invoke the methods exposed by the service through wcftestclient. What are the security issues that I have to deal with? I had to enable Anonymous login with windows auth. and still the invoke generated exceptions that pointed to something related to access violation. On searching some things point to installing certificates to be able to invoke.. Please enlighten if possible.
Try checking if service(name) in the Service Markup (right click on servicename.svc) matches the service(name) in your web.config file.
Cheers!
My silverlight application loads data fromt he SQL fine when I build locally but when I upload it to the live site it will just wait for data to be loaded but show no errors. It worked up until yesterday where I fear I may have changed a setting somewhere and now I cant access the data it seems?
UPDATE 1: it seems to be a problem with the service references. Everytime I update them, it will clear the ServiceReferences.ClientConfig file and then the program wont build.
UPDATE 2: I have tried cleaning and building but still the same problem.
UPDATE 3: Found an error when trying to access the service reference on the live site:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
It sounds like your application is waiting for something, does it time out after 30 seconds? If so, check your SQL connection string.
If there is another tier between Silverlight and SQL (such as a web service), then set up a connection test to make sure that Silverlight is actually reaching SQL...
Did you accidentally replace your live web.config file? If so, try restoring the old web.config as it may have a setting that's not compatable with your server.
Re: Update 1:
Is there an error? If so please paste it. Also please paste the config file in question on pastebin and link to it from here.
Re: Update 3:
The error "This collection already contains an address with scheme http." is caused by not telling a WCF service explicitly what address you wish to bind to when there are many to chosoe from. In this case it looks like IIS is using multiple URLs, for example, consider these fictional addresses:
www.mysite.com
mysite.com
... so the WCF service has no idea which to use unless you tell it.
The solution, to this is to explictly define what URL to use with the following config lines in the web.config (within the system.serviceModel node) of your WCF service.
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://www.mysite.com/SomeDirectory/MyService" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Important:
You should update your question title to indicate that WCF is involved in the solution you have created.