Photograph of Ash Farm, the most likely of the two candidates for the "Brimstone Farm" wherein Coleridge said he composed Kubla Khan; the other being Broomstreet Farm (as depicted below). See another view.
Credit: Martin Southwood, CC by-sa 2.0 license
Kubla Khan, or a Vision in a Dream. A Fragment. was published in 1816, but being mentioned by acquaintances of Coleridge in the 1790s, must have been written over a decade earlier.
The provenance given by Coleridge himself being considered by modern scholarship unreliable, John Spencer Hill summarises that the most widely accepted date of composition is "October or November 1797". The reasoning for this is necessarily complex as Coleridge gives two different dates for when he wrote the poem, and external evidence is scant. The foundation of the reasoning is, however, the earliest note by the author regarding the date, from a manuscript of the poem known as the Crewe Manuscript. This manuscript itself is a bit of an enigma, but T.C. Skeat (1963, in British Museum Quarterly 26, p78) gives the following sketchy provenance for it:
The only possible clue to its origin is a faint pencilled note at the end of the manuscript: "Sent by Mrs Southey, as an Autograph of Coleridge." From this we may conjecture that the manuscript was originally sent by Coleridge to Southey, passed into Mrs Southey's possession after the latter's death in 1843, and was subsequently given by her to some private autograph collector. It subsequently appeared in the sale-room of Messrs Puttick & Simpson on 28 April 1859, when, as lot 109, it was knocked down to Monckton Milnes, owner of a noted collection of autographs, for the modest sum of l pound 15 shillings. From him it descended to his son, afterwards Marquess of Crewe, so the history of the manuscript from 1859 onwards is established.
The manuscript contains a number of textual variants from the published version, including the spelling of Xanadu being the rather more exotic "Xannadù", and "So twice five miles of fertile ground / With walls and towers were girdled round." being originally "So twice six miles of fertile ground / With Walls and Towers were compass'd round." It is believed to be perhaps much earlier than the 1816 published version, though not so old as to be the original manuscript of the poem, so its dating evidence can be taken as perhaps the most reliable primary source we have. There are two sources of images of it: one, recto, verso; two recto. The manuscript is in the British Library, at Additional 58047. [@@ Find better images.]
Photograph of Broomstreet Farm.
Credit: Barbara Cook, CC by-sa 2.0 license
The dating note in the Crewe MS is part of an endnote that would be later expanded upon to form the famous 1816 Preface with its person from Porlock: "This fragment with a good deal more, not recoverable, composed, in a sort of Reverie brought on by two grains of Opium, taken to check a dysentery, at a Farm House between Porlock & Linton, a quarter of a mile from Culbone Church, in the fall of the year 1797._______ S. T. Coleridge". John Spencer Hill has a good piece about the relationship between this and the 1816 Preface.
So that's the date settled perhaps as much as is possile with the current data we have to hand. As for the place, Hill has the following to say on the possibilities for where the poem was written:
As a kind of footnote to the dating-discussion, it may be added that there have been attempts to identify the very farmhouse to which Coleridge retired and wrote Kubla Khan. There have been two suggestions. Wylie Sypher, noting that there are only ten houses in the whole parish of Culbone and that only three farmhouses have ever been built within a mile of Culbone Church, settled on Ash Farm, "a squat, tidy cottage of gray stone" which still stands today. Morchard Bishop, on the other hand, basing his argument on Coleridge's statement (1830) that "I wrote Kubla Khan in Brimstone Farm between Porlock and Ilfracombe -- near Culbone", identified the house as Broomstreet Farm, "since there is no record . . . of any farm in the neighbourhood that goes by the name of Brimstone". Since Ash Farm is much closer to being "a quarter of a mile from Culbone Church" (Crewe endnote) than is Broomstreet Farm, most scholars have preferred the former and have argued that "Coleridge, if he did confuse the real name of the farm long after the event, could have turned Ash into Brimstone as easily [as] Broomstreet into Brimstone". However, J. H. Goodland (who agrees with Bishop) points out that "the local dialect could account for a mishearing; 'Broomstreet' is still pronounced 'Brimson' in the locality" (CN, iii 4006n). Once again, then, there is no consensus -- nor does a definitive conclusion seem possible.
I've transcribed Morchard Bishop's piece, The Farmhouse of Kubla Khan, and put it online because Hill doesn't capture the full subtlety (and in some places, oddness) of Bishop's arguments.
There's a photo from a travel site of the remains of the inner wall of the palace at Yuanshangdu, so that we can see an image of the real Xanadu as it is now.