asp.net mvc - How to deploy mvc application -
i have finished mvc application , want publish on test website. managed publish files publish command in vs, when access link app, nothing.
i used ftp publish website, checked if files on host, are, application not open. index.cshtml not showing. need configuration in order make work ?
also, followed steps http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx.
is there change have make web.release.config , web.debug.config ?
here web.config :
<configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <add name="defaultconnection" connectionstring="data source=xxxxx initial catalog=xxxx; persist security info=true; user id=xxxxx; password=xxxxx" providername="system.data.sqlclient" /> <add name="cdsentities" connectionstring="metadata=res://*/models.cds.csdl|res://*/models.cds.ssdl|res://*/models.cds.msl;provider=system.data.sqlclient;provider connection string="data source=xxxx;initial catalog=xxxxx;user id=xxxx;password=xxxxx;multipleactiveresultsets=true;app=entityframework"" providername="system.data.entityclient" /></connectionstrings>
and here web.release.config :
<system.web> <compilation xdt:transform="removeattributes(debug)" /> <!-- in example below, "replace" transform replace entire <customerrors> section of web.config file. note because there 1 customerrors section under <system.web> node, there no need use "xdt:locator" attribute. <customerrors defaultredirect="genericerror.htm" mode="remoteonly" xdt:transform="replace"> <error statuscode="500" redirect="internalerror.htm"/> </customerrors> -->
and web.debug.config :
<system.web> <!-- in example below, "replace" transform replace entire <customerrors> section of web.config file. note because there 1 customerrors section under <system.web> node, there no need use "xdt:locator" attribute. <customerrors defaultredirect="genericerror.htm" mode="remoteonly" xdt:transform="replace"> <error statuscode="500" redirect="internalerror.htm"/> </customerrors> -->
to answer own question : did following :
publish using vs, added files using ftp on server.
then added following web.config because got following error :
server error in '/' application. there no build provider registered extension '.cshtml'. can register 1 in section in machine.config or web.config. make sure has buildproviderappliestoattribute attribute includes value 'web' or 'all'.
so added following :
<compilation debug="true" targetframework="4.0"> <assemblies> <add assembly="system.web.abstractions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.helpers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.routing, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <add assembly="system.web.webpages, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> </assemblies> </compilation>
after in web.release.config added connection string web.config. give example make clearer :
<connectionstrings> <add name="eaf" connectionstring="data source=ntsqlt\s2k5tst;initial catalog=hr;user id=eafapp;password=xxxx" providername="system.data.sqlclient" /> </connectionstring>
and web.release.config added xdt:transform="setattributes" xdt:locator="match(name)" each connection string.
<connectionstrings> <add name="eaf" connectionstring="data source=ntsqlp\s2k5tst;initial catalog=hr;user id=eafapp;password=yyyy" xdt:transform="setattributes" xdt:locator="match(name)" /> </connectionstrings>
Comments
Post a Comment