问题
When debugging an xslt in VS 2015 I get the following error message
"xsl transformation failed see output window for details WebException Unable to connect to the remote server SocketException No connection could be made because the target machine actively refused it 127.0.0.1:1234"
If I start debugging with my cursor in the xml document (as opposed to xsl) it sometimes works, but not always.
回答1:
In my web project I fixed this by clicking 'debug->start without debugging'. I could then do visual studio xsl debugging in the normal way.
I'm not sure why this fixed the issue. But I think the xsl debugger was fetching an xml schema from localhost and, since 127.0.0.1:1234 wasn't started it wouldn't be able to get it.
But what is it trying to fetch from localhost? I'm guessing, but when I put the cursor in the xsl document and clicked xml->schemas I saw an xsd from the local project. Somehow VS may have thought it was involved in the transfomration, but it wasn't.
I did also use the document function in the xsl. But I could request those documents in a browser so I don't think they could have caused a request refusal.
One other possibility is the document function was requesting a non-dev (non localhost) xml document from the production domain. As I said, the document was fetchable, but perhaps there was a domain of origin restriction?
回答2:
Though the question is already answered, I am posting this so that someone else for whom the answer did not work can have other alternative.
Everything was alright, all files were present in my web app and still VS gave me the 'WebException` when I clicked "Start XSLT Without Debugging". I tried the answer given here but it did not work.
Then I opened my XML file (just the XML file; not the project or solution it is in) in other Visual Studio instance and clicked the same "Start XSLT Without Debugging". And this one worked.
It seems that when you try to transform the file under the web app project, Visual Studio tries to do something extra. But if you don't have necessity to run XSLT by loading the web app project in VS, this answer may help you.
来源:https://stackoverflow.com/questions/39635600/visual-studio-2015-xsl-debugging-transformation-failed-webexception-socketexcept